From a2c9bd286cf061b9c6e6565474c1af77e8cf2d1e Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Wed, 26 Jan 2000 11:38:07 +0000 Subject: [PATCH] Dumping a mountpoint caused the mountpoint to be dumped instead of the mounted disk. Improved the output of dump to tell the subtree actually dumped. --- CHANGES | 10 +++++++++- dump/main.c | 18 +++++++++++------- dump/optr.c | 9 ++++++--- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/CHANGES b/CHANGES index f83917d..d86fccb 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ -$Id: CHANGES,v 1.37 2000/01/25 14:14:12 stelian Exp $ +$Id: CHANGES,v 1.38 2000/01/26 11:38:07 stelian Exp $ Changes between versions 0.4b13 and 0.4b14 (released ????????????????) ====================================================================== @@ -10,6 +10,14 @@ Changes between versions 0.4b13 and 0.4b14 (released ????????????????) Thanks to Jan Sanislo for finding this bug and submitting the patch. +2. Fixed the handling of the filesystem parameter in dump. A + '/mnt/disk' parameter caused the disk contents to be dumped, + but a '/mnt/disk/' parameter caused the mountpoint directory + to be dumped (generally an empty directory). + +3. Improved the output of dump in order to tell which directory + it is currently dumping (when dumping a subtree). + Changes between versions 0.4b12 and 0.4b13 (released January 21, 2000) ====================================================================== diff --git a/dump/main.c b/dump/main.c index cc1ed91..f5fd989 100644 --- a/dump/main.c +++ b/dump/main.c @@ -40,7 +40,7 @@ #ifndef lint static const char rcsid[] = - "$Id: main.c,v 1.13 2000/01/25 14:14:12 stelian Exp $"; + "$Id: main.c,v 1.14 2000/01/26 11:38:08 stelian Exp $"; #endif /* not lint */ #include @@ -344,6 +344,12 @@ main(int argc, char *argv[]) signal(SIGINT, SIG_IGN); set_operators(); /* /etc/group snarfed */ getfstab(); /* /etc/fstab snarfed */ + /* + * disk may end in / and this can confuse + * fstabsearch. + */ + if (strlen(disk) > 1 && disk[strlen(disk) - 1] == '/') + disk[strlen(disk) - 1] = '\0'; /* * disk can be either the full special file name, * the suffix of the special file name, @@ -367,10 +373,10 @@ 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)sprintf(name, "%s (dir %s)", - dt->fs_spec, directory); - (void)strncpy(spcl.c_dev, name, NAMELEN); - (void)strncpy(spcl.c_filesys, dt->fs_file, NAMELEN); + dt->fs_file, directory); + (void)strncpy(spcl.c_filesys, name, NAMELEN); disk = rawname(dt->fs_spec); } else { (void)strncpy(spcl.c_dev, disk, NAMELEN); @@ -421,9 +427,7 @@ main(int argc, char *argv[]) #else spcl.c_ddate == 0 ? "the epoch\n" : ctime(&spcl.c_ddate)); #endif - msg("Dumping %s ", disk); - if (dt != NULL) - msgtail("(%s) ", dt->fs_file); + msg("Dumping %s (%s) ", disk, spcl.c_filesys); if (host) msgtail("to %s on host %s\n", tape, host); else diff --git a/dump/optr.c b/dump/optr.c index 8287df5..fdda1c4 100644 --- a/dump/optr.c +++ b/dump/optr.c @@ -40,7 +40,7 @@ #ifndef lint static const char rcsid[] = - "$Id: optr.c,v 1.8 2000/01/21 10:17:41 stelian Exp $"; + "$Id: optr.c,v 1.9 2000/01/26 11:38:08 stelian Exp $"; #endif /* not lint */ #include @@ -427,8 +427,11 @@ allocfsent(struct fstab *fs) register struct fstab *new; new = (struct fstab *)malloc(sizeof (*fs)); - if (new == NULL || - (new->fs_file = strdup(fs->fs_file)) == NULL || + if (new == NULL) + quit("%s\n", strerror(errno)); + if (strlen(fs->fs_file) > 1 && fs->fs_file[strlen(fs->fs_file) - 1] == '/') + fs->fs_file[strlen(fs->fs_file) - 1] = '\0'; + if ((new->fs_file = strdup(fs->fs_file)) == NULL || (new->fs_type = strdup(fs->fs_type)) == NULL || (new->fs_spec = strdup(fs->fs_spec)) == NULL) quit("%s\n", strerror(errno)); -- 2.39.2