summaryrefslogtreecommitdiffstats
path: root/sbin/bsdlabel
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1998-07-20 11:34:06 +0000
committerbde <bde@FreeBSD.org>1998-07-20 11:34:06 +0000
commit870a72fe1fc3d170d8d7638ecefee02d6ff206b0 (patch)
tree4a05d8586b26809790b49de544f009425145109e /sbin/bsdlabel
parent845dfbe615bd7f6cbc8aae4879013d26a2709527 (diff)
downloadFreeBSD-src-870a72fe1fc3d170d8d7638ecefee02d6ff206b0.zip
FreeBSD-src-870a72fe1fc3d170d8d7638ecefee02d6ff206b0.tar.gz
Clear d_boot0 and d_boot1 in the virgin label. These are overlaid by
d_packname in in-core labels, so they are garbage if d_packname is initialized in the dummy label for the whole disk. dsopen() will soon initialize d_packname to "fictitious" if it is not already initialized. Fixed nearby error handling. Rev.1.7 apparently confused Perror() with perror().
Diffstat (limited to 'sbin/bsdlabel')
-rw-r--r--sbin/bsdlabel/bsdlabel.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sbin/bsdlabel/bsdlabel.c b/sbin/bsdlabel/bsdlabel.c
index 6f7c1b4..7d1b595 100644
--- a/sbin/bsdlabel/bsdlabel.c
+++ b/sbin/bsdlabel/bsdlabel.c
@@ -46,7 +46,7 @@ static char sccsid[] = "@(#)disklabel.c 8.2 (Berkeley) 1/7/94";
/* from static char sccsid[] = "@(#)disklabel.c 1.2 (Symmetric) 11/28/85"; */
#endif
static const char rcsid[] =
- "$Id: disklabel.c,v 1.14 1998/06/08 06:41:47 charnier Exp $";
+ "$Id: disklabel.c,v 1.15 1998/06/28 18:59:04 bde Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -1311,25 +1311,25 @@ getvirginlabel(void)
int f;
if (dkname[0] == '/') {
- fprintf(stderr,
- "\"auto\" requires the usage of a canonical disk name.\n");
+ warnx("\"auto\" requires the usage of a canonical disk name");
return (NULL);
}
(void)snprintf(namebuf, BBSIZE, "%sr%s", _PATH_DEV, dkname);
- if ((f = open(namebuf, O_RDONLY, 0)) == -1) {
- err(4, "open()");
+ if ((f = open(namebuf, O_RDONLY)) == -1) {
+ warn("cannot open %s", namebuf);
return (NULL);
}
if (ioctl(f, DIOCGDINFO, &lab) < 0) {
- err(4, "ioctl DIOCGDINFO");
+ warn("ioctl DIOCGDINFO");
close(f);
return (NULL);
}
close(f);
+ lab.d_boot0 = NULL;
+ lab.d_boot1 = NULL;
return (&lab);
}
-
/*
* If we are installing a boot program that doesn't fit in d_bbsize
* we need to mark those partitions that the boot overflows into.
OpenPOWER on IntegriCloud