Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/dump Fix handling of NAME aliases in /etc/fstab.
details: https://anonhg.NetBSD.org/src/rev/678ec6a37621
branches: trunk
changeset: 789813:678ec6a37621
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Sun Sep 08 13:26:05 2013 +0000
description:
Fix handling of NAME aliases in /etc/fstab.
diffstat:
sbin/dump/main.c | 21 ++++++++++-----------
sbin/dump/optr.c | 10 +++-------
2 files changed, 13 insertions(+), 18 deletions(-)
diffs (91 lines):
diff -r fe6893404a4b -r 678ec6a37621 sbin/dump/main.c
--- a/sbin/dump/main.c Sun Sep 08 13:24:16 2013 +0000
+++ b/sbin/dump/main.c Sun Sep 08 13:26:05 2013 +0000
@@ -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 @@
#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 @@
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 @@
== 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 -r fe6893404a4b -r 678ec6a37621 sbin/dump/optr.c
--- a/sbin/dump/optr.c Sun Sep 08 13:24:16 2013 +0000
+++ b/sbin/dump/optr.c Sun Sep 08 13:26:05 2013 +0000
@@ -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 @@
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);
Home |
Main Index |
Thread Index |
Old Index