]> git.wh0rd.org - dump.git/blobdiff - dump/main.c
Made dump able to dump files bigger than 2 GB.
[dump.git] / dump / main.c
index 43c31168f070429dbb8f7a3d7830c15d6ec20e7b..6bf9a53718a1e40abcb6a081376e654b0b08c332 100644 (file)
@@ -40,7 +40,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: main.c,v 1.24 2000/08/20 19:41:50 stelian Exp $";
+       "$Id: main.c,v 1.26 2000/09/26 12:34:52 stelian Exp $";
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -202,8 +202,15 @@ main(int argc, char *argv[])
                        
                                        /* 04-Feb-00 ILC */
                case 'e':               /* exclude an inode */
-                       iexclude_list[iexclude_num++] = 
-                         numarg("inode to exclude",0L,0L);
+                       if (iexclude_num == IEXCLUDE_MAXNUM) {
+                               (void)fprintf(stderr, "Too many -e options\n");
+                               exit(X_STARTUP);
+                       }
+                       iexclude_list[iexclude_num++] = numarg("inode to exclude",0L,0L);
+                       if (iexclude_list[iexclude_num-1] <= ROOTINO) {
+                               (void)fprintf(stderr, "Cannot exclude inode %ld\n", iexclude_list[iexclude_num-1]);
+                               exit(X_STARTUP);
+                       }
                        msg("Added %d to exclude list\n",
                            iexclude_list[iexclude_num-1]);
                        break;
@@ -391,26 +398,36 @@ main(int argc, char *argv[])
                (void)strncpy(spcl.c_filesys, dt->fs_file, NAMELEN);
 #ifdef __linux__
        } else {
-               /*
-                * The argument was not found in the fstab
-                * assume that this is a subtree and search for it
-                */
 #ifdef HAVE_REALPATH
                if (realpath(disk, pathname) == NULL)
 #endif
                        strcpy(pathname, disk);
-               dt = fstabsearchdir(pathname, directory);
-               if (dt != NULL) {
-                       char name[MAXPATHLEN];
-                       (void)strncpy(spcl.c_dev, dt->fs_spec, NAMELEN);
-                       (void)snprintf(name, sizeof(name), "%s (dir %s)",
-                                     dt->fs_file, directory);
-                       (void)strncpy(spcl.c_filesys, name, NAMELEN);
+               /*
+                * The argument could be now a mountpoint of
+                * 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);
                } else {
-                       (void)strncpy(spcl.c_dev, disk, NAMELEN);
-                       (void)strncpy(spcl.c_filesys, "an unlisted file system",
-                           NAMELEN);
+                       /*
+                        * The argument was not found in the fstab
+                        * assume that this is a subtree and search for it
+                        */
+                       dt = fstabsearchdir(pathname, directory);
+                       if (dt != NULL) {
+                               char name[MAXPATHLEN];
+                               (void)strncpy(spcl.c_dev, dt->fs_spec, NAMELEN);
+                               (void)snprintf(name, sizeof(name), "%s (dir %s)",
+                                             dt->fs_file, directory);
+                               (void)strncpy(spcl.c_filesys, name, NAMELEN);
+                               disk = rawname(dt->fs_spec);
+                       } else {
+                               (void)strncpy(spcl.c_dev, disk, NAMELEN);
+                               (void)strncpy(spcl.c_filesys, "an unlisted file system",
+                                   NAMELEN);
+                       }
                }
        }
 #else