Index | Thread | Search

From:
Klemens Nanni <kn@openbsd.org>
Subject:
vmctl: show file path in error message
To:
OpenBSD tech <tech@openbsd.org>
Date:
Thu, 1 May 2025 14:15:36 +0000

Download raw body.

Thread
I passed multiple '-d path/file' arguments to 'vmctl start' and it took me
a while to find the typo amongst them since the error does not really help:

	vmctl: invalid disk path: No such file or directory

This does:
	vmctl: invalid disk path: /home/kn/instal.img: No such file or directory

OK?

Index: main.c
===================================================================
RCS file: /cvs/src/usr.sbin/vmctl/main.c,v
diff -u -p -r1.84 main.c
--- main.c	21 Nov 2024 13:39:34 -0000	1.84
+++ main.c	1 May 2025 14:12:53 -0000
@@ -863,7 +863,7 @@ ctl_start(struct parse_result *res, int 
 			if (res->isopath)
 				errx(1, "iso image specified multiple times");
 			if (realpath(optarg, path) == NULL)
-				err(1, "invalid iso image path");
+				err(1, "invalid iso image path: %s", optarg);
 			if ((res->isopath = strdup(path)) == NULL)
 				errx(1, "strdup");
 			break;
@@ -886,7 +886,7 @@ ctl_start(struct parse_result *res, int 
 		case 'd':
 			type = parse_disktype(optarg, &s);
 			if (realpath(s, path) == NULL)
-				err(1, "invalid disk path");
+				err(1, "invalid disk path: %s", s);
 			if (parse_disk(res, path, type) != 0)
 				errx(1, "invalid disk: %s", optarg);
 			break;