]> git.wh0rd.org - dump.git/blobdiff - dump/optr.c
A wrong line in /etc/fstab containing LABEL=... could prevent dump from running....
[dump.git] / dump / optr.c
index 5f275ed5b75487ac68454f7ce4ef3e54db9d0338..a4504da1520f0078201bfbb2e295cfc6e69c3222 100644 (file)
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
@@ -41,7 +37,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: optr.c,v 1.34 2003/01/21 10:42:27 stelian Exp $";
+       "$Id: optr.c,v 1.39 2004/07/05 15:12:45 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
@@ -448,7 +444,7 @@ allocfsent(struct mntent *fs)
        /* Translade UUID=, LABEL= ... */
        disk = get_device_name(fs->mnt_fsname);
        if (disk == NULL)
-               quit("Cannot find a disk having %s\n", fs->mnt_fsname);
+               disk = strdup(fs->mnt_fsname);
 
        /* Discard non block devices */
        if (stat(disk, &buf) != 0 || !S_ISBLK(buf.st_mode)) {
@@ -464,6 +460,12 @@ allocfsent(struct mntent *fs)
                        quit("Cannot access %s\n", tabfs->mnt_fsname);
                if (tabbuf.st_rdev == buf.st_rdev) {
                        free(new);
+                       /* Copy passno and freq from /etc/fstab because 
+                        * /etc/mtab does always have them as 0 0 */
+                       if (!tabfs->mnt_passno)
+                               tabfs->mnt_passno = fs->mnt_passno;
+                       if (!tabfs->mnt_freq)
+                               tabfs->mnt_freq = fs->mnt_freq;
                        return NULL;
                }
        }
@@ -487,7 +489,7 @@ getfstab(void)
        struct pfstab *pf;
        struct pfstab *pfold = NULL;
        FILE *mntfp;
-       char *mnttables[] = { _PATH_MNTTAB, _PATH_MOUNTED, 0 };
+       char *mnttables[] = { _PATH_MOUNTED, _PATH_MNTTAB, 0 };
        int i;
 
        for (i = 0; mnttables[i]; i++) {
@@ -618,7 +620,7 @@ print_wmsg(char arg, int dumpme, const char *dev, int level,
                date = (char *)ctime(&ddate);
                d = strchr(date, '\n');
                if (d) *d = '\0';
-               printf("Level %c, Date %s\n", level, date);
+               printf("Level %d, Date %s\n", level, date);
        } else
                printf("never\n");
 }