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().
This commit is contained in:
Bruce Evans 1998-07-20 11:34:06 +00:00
parent e1fe6b4298
commit e18fb238dc
2 changed files with 14 additions and 14 deletions

View File

@ -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.

View File

@ -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.