X-Git-Url: https://git.wh0rd.org/?p=dump.git;a=blobdiff_plain;f=dump%2Fmain.c;h=74ca0be0d72aaa9adf9721087bccb1e60f26b5e1;hp=cecaaae79be572f16462083c3fa62479850f876b;hb=62614cf50e5f719954f23b7a9819a70b2d3ec44c;hpb=28ba5caee0ed25d3b38da769967173e5710bc10c diff --git a/dump/main.c b/dump/main.c index cecaaae..74ca0be 100644 --- a/dump/main.c +++ b/dump/main.c @@ -37,7 +37,7 @@ #ifndef lint static const char rcsid[] = - "$Id: main.c,v 1.92 2004/04/21 08:55:51 stelian Exp $"; + "$Id: main.c,v 1.96 2009/07/23 09:34:07 stelian Exp $"; #endif /* not lint */ #include @@ -58,6 +58,7 @@ static const char rcsid[] = #include #include #ifdef __linux__ +#include #ifdef HAVE_EXT2FS_EXT2_FS_H #include #else @@ -238,6 +239,8 @@ main(int argc, char *argv[]) quit("TP_BSIZE must be a multiple of DEV_BSIZE\n"); memset(&lastlevel, 0, NUM_STR_SIZE); memset(&level, 0, NUM_STR_SIZE); + /* Default dump level is zero. */ + level[0] = '0'; if (argc < 2) usage(); @@ -540,7 +543,7 @@ main(int argc, char *argv[]) } (void)setuid(getuid()); /* rmthost() is the only reason to be setuid */ - if (Apath && (Afile = open(Apath, O_WRONLY|O_CREAT|O_TRUNC, + if (Apath && (Afile = OPEN(Apath, O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) < 0) { msg("Cannot open %s for writing: %s\n", @@ -583,13 +586,9 @@ main(int argc, char *argv[]) diskparam[i] = '\0'; disk = get_device_name(diskparam); - if (!disk) { /* null means the disk is some form - of LABEL= or UID= but it was not - found */ - msg("Cannot find a disk having %s\n", diskparam); - msg("The ENTIRE dump is aborted.\n"); - exit(X_STARTUP); - } + if (!disk) + disk = strdup(diskparam); + /* * disk can be either the full special file name, * the suffix of the special file name,