diff options
| author | mlelstv <mlelstv@NetBSD.org> | 2013-09-08 13:26:05 +0000 |
|---|---|---|
| committer | mlelstv <mlelstv@NetBSD.org> | 2013-09-08 13:26:05 +0000 |
| commit | 8afd3d1200d4f4a822202563d37f9b65f3b1e05b (patch) | |
| tree | e85ea20d38c7f1028f2abc7edf78e6b4df7e2cf2 /sbin/dump | |
| parent | 60ed6ea710e53e10f07640a6097a949c6faed9f1 (diff) | |
Fix handling of NAME aliases in /etc/fstab.
Diffstat (limited to 'sbin/dump')
| -rw-r--r-- | sbin/dump/main.c | 21 | ||||
| -rw-r--r-- | sbin/dump/optr.c | 10 |
2 files changed, 13 insertions, 18 deletions
diff --git a/sbin/dump/main.c b/sbin/dump/main.c index 6beaa64567e..d8c9718de49 100644 --- a/sbin/dump/main.c +++ b/sbin/dump/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.70 2013/06/15 01:27:19 christos Exp $ */ +/* $NetBSD: main.c,v 1.71 2013/09/08 13:26:05 mlelstv Exp $ */ /*- * Copyright (c) 1980, 1991, 1993, 1994 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1991, 1993, 1994\ #if 0 static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/1/95"; #else -__RCSID("$NetBSD: main.c,v 1.70 2013/06/15 01:27:19 christos Exp $"); +__RCSID("$NetBSD: main.c,v 1.71 2013/09/08 13:26:05 mlelstv Exp $"); #endif #endif /* not lint */ @@ -280,22 +280,20 @@ main(int argc, char *argv[]) dirc = 0; for (i = 0; i < argc; i++) { struct stat sb; + int error; - if (lstat(argv[i], &sb) == -1) - quit("Cannot stat %s: %s\n", argv[i], strerror(errno)); - if (Fflag || S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode)) { + error = lstat(argv[i], &sb); + if (Fflag || (!error && (S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode)))) { + if (error) + quit("Cannot stat %s: %s\n", argv[i], strerror(errno)); disk = argv[i]; multicheck: if (dirc != 0) - quit( - "Can't dump a disk or image at the same time as a file list\n"); + quit("Can't dump a disk or image at the same time as a file list\n"); break; } if ((dt = fstabsearch(argv[i])) != NULL) { - if (getfsspecname(buf, sizeof(buf), dt->fs_spec) - == NULL) - quit("%s (%s)", buf, strerror(errno)); - disk = buf; + disk = argv[i]; mountpoint = xstrdup(dt->fs_file); goto multicheck; } @@ -416,6 +414,7 @@ main(int argc, char *argv[]) == NULL) quit("Can't get disk raw name for `%s' (%s)", mntinfo->f_mntfromname, strerror(errno)); + disk = rbuf; mountpoint = mntinfo->f_mntonname; msg("Found %s on %s in mount table\n", disk, mountpoint); } diff --git a/sbin/dump/optr.c b/sbin/dump/optr.c index 058c86dd4f6..6d1f0e4751a 100644 --- a/sbin/dump/optr.c +++ b/sbin/dump/optr.c @@ -1,4 +1,4 @@ -/* $NetBSD: optr.c,v 1.41 2013/06/15 01:27:19 christos Exp $ */ +/* $NetBSD: optr.c,v 1.42 2013/09/08 13:26:05 mlelstv Exp $ */ /*- * Copyright (c) 1980, 1988, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)optr.c 8.2 (Berkeley) 1/6/94"; #else -__RCSID("$NetBSD: optr.c,v 1.41 2013/06/15 01:27:19 christos Exp $"); +__RCSID("$NetBSD: optr.c,v 1.42 2013/09/08 13:26:05 mlelstv Exp $"); #endif #endif /* not lint */ @@ -320,15 +320,11 @@ static struct fstab * allocfsent(const struct fstab *fs) { struct fstab *new; - char buf[MAXPATHLEN]; new = xmalloc(sizeof (*fs)); new->fs_file = xstrdup(fs->fs_file); new->fs_type = xstrdup(fs->fs_type); - - if (getfsspecname(buf, sizeof(buf), fs->fs_spec) == NULL) - msg("%s (%s)", buf, strerror(errno)); - new->fs_spec = xstrdup(buf); + new->fs_spec = xstrdup(fs->fs_spec); new->fs_passno = fs->fs_passno; new->fs_freq = fs->fs_freq; return (new); |
