bin/58390: bsdlabel fails to display an error message if the label could not be written

Martin Faxer martin.faxer at
Wed Oct 22 11:40:22 PDT 2003

>Number:         58390
>Category:       bin
>Synopsis:       bsdlabel fails to display an error message if the label could not be written
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 22 11:40:18 PDT 2003
>Originator:     Martin Faxer
>Release:        FreeBSD 5.1-CURRENT-20031018-JPSNAP i386
System: FreeBSD 5.1-CURRENT-20031018-JPSNAP FreeBSD 5.1-CURRENT-20031018-JPSNAP #0: Mon Oct 20 15:21:10 CEST 2003 redpixel at i386

bsdlabel fails to display any kind of error message when opening the special
device fails.  this might lead one to believe that the label was written when
it infact wasn't.  quite annoying!
run bsdlabel on any special device that is bound to fail (eg. a currently
mounted disk) and try to save the label.  no error messages will appear but
the label will not get written to disk.
apply the patch below.

(i'm not really sure what all that geom code is trying to accomplish, since
the device can't be opened...  as far as i know my system is geom but the
code path taken in successful editing seems to be the write())

--- bsdlabel.diff begins here ---
Index: sbin/bsdlabel/bsdlabel.c
RCS file: /home/ncvs/src/sbin/bsdlabel/bsdlabel.c,v
retrieving revision 1.103
diff -u -r1.103 bsdlabel.c
--- sbin/bsdlabel/bsdlabel.c	18 Oct 2003 19:32:35 -0000	1.103
+++ sbin/bsdlabel/bsdlabel.c	22 Oct 2003 18:34:16 -0000
@@ -383,6 +383,7 @@
 	fd = open(specname, O_RDWR);
 	if (fd < 0) {
+		warn("updated label could not be written to disk");
 		grq = gctl_get_handle();
 		gctl_ro_param(grq, "verb", -1, "write label");
 		gctl_ro_param(grq, "class", -1, "BSD");
--- bsdlabel.diff ends here ---


More information about the freebsd-bugs mailing list