Improve error message when failing to open a backing file

When bhyve cannot open a backing file, it now says explicitly which file
could not be opened

Note that the change has only be maed in block_if.c and not in
pci_virtio_block.c as the error will always be catched by the first

PR:		202321 (different patch)
Reviewed by:	grehan
MFC after:	3 day
Sponsored by:	Gandi.net
Differential Revision:	https://reviews.freebsd.org/D6576
This commit is contained in:
Baptiste Daroussin 2016-05-27 11:46:54 +00:00
parent 1972e0c429
commit 86bdfe1565
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=300843

View File

@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
#include <sys/disk.h>
#include <assert.h>
#include <err.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
@ -447,12 +448,12 @@ blockif_open(const char *optstr, const char *ident)
}
if (fd < 0) {
perror("Could not open backing file");
warn("Could not open backing file: %s", nopt);
goto err;
}
if (fstat(fd, &sbuf) < 0) {
perror("Could not stat backing file");
warn("Could not stat backing file %s", nopt);
goto err;
}