aboutsummaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorJordan K. Hubbard <jkh@FreeBSD.org>1996-11-09 20:21:47 +0000
committerJordan K. Hubbard <jkh@FreeBSD.org>1996-11-09 20:21:47 +0000
commit19f5c35ec208572ac8b08c0561facec3ee90291d (patch)
tree8cec3efcf2756a7973163a643a5e358443e66827 /sbin
parentc31f183aa38e02972e705c51319c45f271d75aec (diff)
Notes
Diffstat (limited to 'sbin')
-rw-r--r--sbin/disklabel/disklabel.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c
index 5fcd1cdb7056..3de7004e0f41 100644
--- a/sbin/disklabel/disklabel.c
+++ b/sbin/disklabel/disklabel.c
@@ -1329,20 +1329,26 @@ getvirginlabel(void)
if (dkname[0] == '/') {
fprintf(stderr,
"\"auto\" requires the usage of a canonical disk name.\n");
- return (NULL);
+ return 0;
}
(void)snprintf(namebuf, BBSIZE, "%sr%s", _PATH_DEV, dkname);
if ((f = open(namebuf, O_RDONLY, 0)) == -1) {
Perror("open()");
- return (NULL);
+ return 0;
}
if (ioctl(f, DIOCGDINFO, &lab) < 0) {
Perror("ioctl DIOCGDINFO");
close(f);
- return (NULL);
+ return 0;
}
close(f);
- return (&lab);
+ /* insert reasonable defaults where necessary */
+ if (lab.d_npartitions < 8) lab.d_npartitions = 8;
+ if (lab.d_bbsize == 0) lab.d_bbsize = BBSIZE;
+ if (lab.d_sbsize == 0) lab.d_sbsize = SBSIZE;
+ if (lab.d_rpm == 0) lab.d_rpm = 3600;
+ if (lab.d_interleave == 0) lab.d_interleave = 1;
+ return &lab;
}