Module Name:    src
Committed By:   mlelstv
Date:           Sun Sep  8 13:26:05 UTC 2013

Modified Files:
        src/sbin/dump: main.c optr.c

Log Message:
Fix handling of NAME aliases in /etc/fstab.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sbin/dump/main.c
cvs rdiff -u -r1.41 -r1.42 src/sbin/dump/optr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/dump/main.c
diff -u src/sbin/dump/main.c:1.70 src/sbin/dump/main.c:1.71
--- src/sbin/dump/main.c:1.70	Sat Jun 15 01:27:19 2013
+++ src/sbin/dump/main.c	Sun Sep  8 13:26:05 2013
@@ -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, 19
 #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);
 	}

Index: src/sbin/dump/optr.c
diff -u src/sbin/dump/optr.c:1.41 src/sbin/dump/optr.c:1.42
--- src/sbin/dump/optr.c:1.41	Sat Jun 15 01:27:19 2013
+++ src/sbin/dump/optr.c	Sun Sep  8 13:26:05 2013
@@ -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);

Reply via email to