Try to open the file before configuring a vnode disk device to avoid silly

error messages when the file cannot be opened for some reason. This fixes
PR bin/12445 by <knotwell@ix.netcom.com>.
This commit is contained in:
tron 2001-11-08 07:44:32 +00:00
parent 9cc2cb211f
commit 316d7126f6

View File

@ -1,4 +1,4 @@
/* $NetBSD: vnconfig.c,v 1.22 2001/11/08 02:14:09 christos Exp $ */
/* $NetBSD: vnconfig.c,v 1.23 2001/11/08 07:44:32 tron Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -205,12 +205,20 @@ config(dev, file, geom, action)
* Configure the device
*/
if (action == VND_CONFIG) {
int ffd;
ffd = open(file, O_RDWR);
if (ffd < 0)
warn("%s", file);
else {
(void) close(ffd);
rv = ioctl(fd, VNDIOCSET, &vndio);
if (rv)
warn("%s: VNDIOCSET", rdev);
else if (verbose) {
printf("%s: %d bytes on %s", rdev, vndio.vnd_size,
file);
printf("%s: %d bytes on %s", rdev,
vndio.vnd_size, file);
if (vndio.vnd_flags & VNDIOF_HASGEOM)
printf(" using geometry %d/%d/%d/%d",
vndio.vnd_geom.vng_secsize,
@ -219,7 +227,7 @@ config(dev, file, geom, action)
vndio.vnd_geom.vng_ncylinders);
printf("\n");
}
}
}
(void) close(fd);