1
0
mirror of https://github.com/openbsd/src.git synced 2024-12-22 16:42:56 -08:00

Don't print device when passed as an argument

r1.11 "Don't print device name on failure" made it print unconditionally,
which contradicts what the manual says.

Report + diff from Brin Conway <bconway AT rcesoftware DOT com>, thanks.

From Brian Conway
This commit is contained in:
kn 2022-10-04 06:52:52 +00:00
parent 2bf3c082f7
commit 80411f110b

View File

@ -1,4 +1,4 @@
/* $OpenBSD: vnconfig.c,v 1.11 2022/09/01 01:52:08 kn Exp $ */
/* $OpenBSD: vnconfig.c,v 1.12 2022/10/04 06:52:52 kn Exp $ */
/*
* Copyright (c) 1993 University of Utah.
* Copyright (c) 1990, 1993
@ -284,11 +284,12 @@ config(char *file, char *dev, struct disklabel *dp, char *key, size_t keylen)
struct vnd_ioctl vndio;
char *rdev;
int fd, rv = -1;
int unit;
int unit, print_dev = 0;
if (dev == NULL) {
if (getinfo(NULL, &unit) == -1)
err(1, "no devices available");
print_dev = 1;
asprintf(&dev, "vnd%d", unit);
}
@ -312,7 +313,8 @@ config(char *file, char *dev, struct disklabel *dp, char *key, size_t keylen)
if (rv)
warn("VNDIOCSET");
else {
printf("%s\n", dev);
if (print_dev)
printf("%s\n", dev);
if (verbose)
fprintf(stderr, "%s: %llu bytes on %s\n", dev,
vndio.vnd_size, file);