Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/fdisk print the name of the disk causing the error.



details:   https://anonhg.NetBSD.org/src/rev/71c58598d34f
branches:  trunk
changeset: 460097:71c58598d34f
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Oct 07 20:56:07 2019 +0000

description:
print the name of the disk causing the error.

diffstat:

 sbin/fdisk/fdisk.c |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (54 lines):

diff -r ac0a8f5c5aa0 -r 71c58598d34f sbin/fdisk/fdisk.c
--- a/sbin/fdisk/fdisk.c        Mon Oct 07 14:29:28 2019 +0000
+++ b/sbin/fdisk/fdisk.c        Mon Oct 07 20:56:07 2019 +0000
@@ -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 @@
                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 @@
        }
 #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);
                }
        }



Home | Main Index | Thread Index | Old Index