From: Markus Armbruster Date: Fri, 21 Nov 2025 12:14:29 +0000 (+0100) Subject: hw/scsi: Use error_setg_file_open() for a better error message X-Git-Tag: v10.2.0-rc2~4^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d85f1d4492f0ef7347c488ae1d7f6f03a892573;p=thirdparty%2Fqemu.git hw/scsi: Use error_setg_file_open() for a better error message The error message changes from vhost-scsi: open vhost char device failed: REASON to Could not open '/dev/vhost-scsi': REASON I think the exact file name is more useful to know than the file's purpose. We could put back the "vhost-scsi: " prefix with error_prepend(). Not worth the bother. Signed-off-by: Markus Armbruster Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20251121121438.1249498-7-armbru@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c index cdf405b0f8..239138c931 100644 --- a/hw/scsi/vhost-scsi.c +++ b/hw/scsi/vhost-scsi.c @@ -245,8 +245,7 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp) } else { vhostfd = open("/dev/vhost-scsi", O_RDWR); if (vhostfd < 0) { - error_setg(errp, "vhost-scsi: open vhost char device failed: %s", - strerror(errno)); + error_setg_file_open(errp, errno, "/dev/vhost-scsi"); return; } }