From 86a31183e9fc14e2204322878d7e9673be6a0c36 Mon Sep 17 00:00:00 2001 From: bapt Date: Fri, 27 May 2016 11:46:54 +0000 Subject: [PATCH] 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 --- usr.sbin/bhyve/block_if.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr.sbin/bhyve/block_if.c b/usr.sbin/bhyve/block_if.c index b6cb4090e47b..187d178d0d0c 100644 --- a/usr.sbin/bhyve/block_if.c +++ b/usr.sbin/bhyve/block_if.c @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -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; }