Module Name:    src
Committed By:   christos
Date:           Mon Oct  7 20:56:07 UTC 2019

Modified Files:
        src/sbin/fdisk: fdisk.c

Log Message:
print the name of the disk causing the error.


To generate a diff of this commit:
cvs rdiff -u -r1.156 -r1.157 src/sbin/fdisk/fdisk.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/fdisk/fdisk.c
diff -u src/sbin/fdisk/fdisk.c:1.156 src/sbin/fdisk/fdisk.c:1.157
--- src/sbin/fdisk/fdisk.c:1.156	Wed Nov 14 07:05:29 2018
+++ src/sbin/fdisk/fdisk.c	Mon Oct  7 16:56:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: fdisk.c,v 1.156 2018/11/14 12:05:29 mlelstv Exp $ */
+/*	$NetBSD: fdisk.c,v 1.157 2019/10/07 20:56:07 christos Exp $ */
 
 /*
  * Mach Operating System
@@ -39,7 +39,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: fdisk.c,v 1.156 2018/11/14 12:05:29 mlelstv Exp $");
+__RCSID("$NetBSD: fdisk.c,v 1.157 2019/10/07 20:56:07 christos Exp $");
 #endif /* not lint */
 
 #define MBRPTYPENAMES
@@ -2620,19 +2620,19 @@ get_params(void)
 		struct disklabel *tmplabel;
 
 		if ((tmplabel = getdiskbyname(disk_type)) == NULL) {
-			warn("bad disktype");
+			warn("%s: bad disktype", disk);
 			return (-1);
 		}
 		disklabel = *tmplabel;
 	} else if (F_flag) {
 		struct stat st;
 		if (fstat(fd, &st) == -1) {
-			warn("fstat");
+			warn("%s: fstat", disk);
 			return (-1);
 		}
 		if (st.st_size % 512 != 0) {
-			warnx("%s size (%lld) is not divisible "
-			    "by sector size (%d)", disk, (long long)st.st_size,
+			warnx("%s size (%ju) is not divisible "
+			    "by sector size (%d)", disk, (uintmax_t)st.st_size,
 			    512);
 		}
 		disklabel.d_secperunit = st.st_size / 512;
@@ -2644,9 +2644,9 @@ get_params(void)
 	}
 #if !HAVE_NBTOOL_CONFIG_H
 	else if (ioctl(fd, DIOCGDEFLABEL, &disklabel) == -1) {
-		warn("DIOCGDEFLABEL");
+		warn("%s: DIOCGDEFLABEL", disk);
 		if (ioctl(fd, DIOCGDINFO, &disklabel) == -1) {
-			warn("DIOCGDINFO");
+			warn("%s: DIOCGDINFO", disk);
 			return (-1);
 		}
 	}

Reply via email to