X-Git-Url: https://git.wh0rd.org/?p=dump.git;a=blobdiff_plain;f=dump%2Fmain.c;h=57ab0033f0bc4bb6a67b788ebaf4503d3efbcc0c;hp=d06c2fde3863fe2b1c98fe45a132835535a22e38;hb=3211c85bf71bbbe784de3f4fa01a8c0f96a060d6;hpb=a18d599791e977f3e3d26123031e6ed4e64d6d08 diff --git a/dump/main.c b/dump/main.c index d06c2fd..57ab003 100644 --- a/dump/main.c +++ b/dump/main.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: main.c,v 1.74 2002/07/19 14:57:39 stelian Exp $"; + "$Id: main.c,v 1.79 2003/01/10 10:31:10 stelian Exp $"; #endif /* not lint */ #include @@ -49,13 +49,13 @@ static const char rcsid[] = #include #include #include -#include #include #include #include #include #include #include +#include #include #include @@ -181,7 +181,7 @@ long uncomprblks = 0;/* uncompressed blocks written */ char *__progname; #endif -int maxbsize = 64*1024; /* XXX MAXBSIZE from sys/param.h */ +int maxbsize = 1024*1024; /* XXX MAXBSIZE from sys/param.h */ static long numarg __P((const char *, long, long)); static void obsolete __P((int *, char **[])); static void usage __P((void)); @@ -198,7 +198,7 @@ main(int argc, char *argv[]) dump_ino_t ino; int dirty; struct dinode *dp; - struct fstab *dt; + struct mntent *dt; char *map; int ch; int i, anydirskipped; @@ -293,7 +293,7 @@ main(int argc, char *argv[]) case 'b': /* blocks per tape write */ ntrec = numarg("number of blocks per write", - 1L, 1000L); + 1L, 1048576L); if (ntrec > maxbsize/1024) { msg("Please choose a blocksize <= %dkB\n", maxbsize/1024); @@ -355,7 +355,7 @@ main(int argc, char *argv[]) case 'I': breademax = - numarg ("number of errors to ignore", 1L, 0L); + numarg ("number of errors to ignore", 0L, 0L); break; #ifdef KERBEROS @@ -570,9 +570,9 @@ main(int argc, char *argv[]) msg("The ENTIRE dump is aborted.\n"); exit(X_STARTUP); } - disk = rawname(dt->fs_spec); - (void)strncpy(spcl.c_dev, dt->fs_spec, NAMELEN); - (void)strncpy(spcl.c_filesys, dt->fs_file, NAMELEN); + disk = rawname(dt->mnt_fsname); + (void)strncpy(spcl.c_dev, dt->mnt_fsname, NAMELEN); + (void)strncpy(spcl.c_filesys, dt->mnt_dir, NAMELEN); } else { #ifdef __linux__ #ifdef HAVE_REALPATH @@ -584,9 +584,9 @@ main(int argc, char *argv[]) * a filesystem specified in fstab. Search for it. */ if ((dt = fstabsearch(pathname)) != NULL) { - disk = rawname(dt->fs_spec); - (void)strncpy(spcl.c_dev, dt->fs_spec, NAMELEN); - (void)strncpy(spcl.c_filesys, dt->fs_file, NAMELEN); + disk = rawname(dt->mnt_fsname); + (void)strncpy(spcl.c_dev, dt->mnt_fsname, NAMELEN); + (void)strncpy(spcl.c_filesys, dt->mnt_dir, NAMELEN); } else { /* * The argument was not found in the fstab @@ -595,11 +595,11 @@ main(int argc, char *argv[]) dt = fstabsearchdir(pathname, directory); if (dt != NULL) { char name[MAXPATHLEN]; - (void)strncpy(spcl.c_dev, dt->fs_spec, NAMELEN); + (void)strncpy(spcl.c_dev, dt->mnt_fsname, NAMELEN); (void)snprintf(name, sizeof(name), "%s (dir %s)", - dt->fs_file, directory); + dt->mnt_dir, directory); (void)strncpy(spcl.c_filesys, name, NAMELEN); - disk = rawname(dt->fs_spec); + disk = rawname(dt->mnt_fsname); } else { (void)strncpy(spcl.c_dev, disk, NAMELEN); (void)strncpy(spcl.c_filesys, "an unlisted file system", @@ -798,14 +798,14 @@ main(int argc, char *argv[]) /* check if file is a directory */ if (!(statbuf.st_mode & S_IFDIR)) anydirskipped2 = maponefile(maxino, &tapesize, - p+strlen(dt->fs_file)); + p+strlen(dt->mnt_dir)); else /* read directory inodes. * NOTE: nested directories are not recognized * so inodes may be umped twice! */ anydirskipped2 = mapfilesfromdir(maxino, &tapesize, - p+strlen(dt->fs_file)); + p+strlen(dt->mnt_dir)); if (!anydirskipped) anydirskipped = anydirskipped2; argv++; @@ -1227,10 +1227,10 @@ do_exclude_ino(dump_ino_t ino, const char *reason) exit(X_STARTUP); } if (reason) - msg("Added inode %u to exclude list (%s)\n", + msg("Excluding inode %u (%s) from dump\n", ino, reason); else - msg("Added inode %u to exclude list\n", ino); + msg("Excluding inode %u from dump\n", ino); iexclude_list[iexclude_num++] = ino; } } @@ -1241,7 +1241,7 @@ do_exclude_ino_str(char * ino) { unsigned long inod; inod = strtoul(ino, &r, 10); - if (*r != '\0' || inod <= ROOTINO) { + if (( *r != '\0' && !isspace(*r) ) || inod <= ROOTINO) { msg("Invalid inode argument %s\n", ino); msg("The ENTIRE dump is aborted.\n"); exit(X_STARTUP);