I have on vm.conf, vmd does not need it, but complains:
Apr 23 17:12:50 atar vmd[79320]: failed to open /etc/vm.conf: No such file or
directory
We've fixed the same for dhcpleased a year ago, port the diff from there.
Works for me with good, with bad and without /etc/vm.conf.
Feedback? OK?
Index: parse.y
===================================================================
RCS file: /cvs/src/usr.sbin/vmd/parse.y,v
retrieving revision 1.63
diff -u -p -r1.63 parse.y
--- parse.y 28 Jan 2023 14:40:53 -0000 1.63
+++ parse.y 24 Apr 2023 13:39:44 -0000
@@ -1181,9 +1181,13 @@ popfile(void)
int
parse_config(const char *filename)
{
- struct sym *sym, *next;
+ extern const char default_conffile[];
+ struct sym *sym, *next;
if ((file = pushfile(filename, 0)) == NULL) {
+ /* no default config file is fine */
+ if (errno == ENOENT && filename == default_conffile)
+ return (0);
log_warn("failed to open %s", filename);
if (errno == ENOENT)
return (0);
Index: vmd.c
===================================================================
RCS file: /cvs/src/usr.sbin/vmd/vmd.c,v
retrieving revision 1.142
diff -u -p -r1.142 vmd.c
--- vmd.c 23 Apr 2023 12:11:37 -0000 1.142
+++ vmd.c 24 Apr 2023 13:39:21 -0000
@@ -89,6 +89,9 @@ static struct privsep_proc *proc_priv =
static struct passwd proc_privpw;
static const uint8_t zero_mac[ETHER_ADDR_LEN];
+const char default_conffile[] = VMD_CONF;
+const char *conffile = default_conffile;
+
int
vmd_dispatch_control(int fd, struct privsep_proc *p, struct imsg *imsg)
{
@@ -767,7 +770,6 @@ main(int argc, char **argv)
{
struct privsep *ps;
int ch;
- const char *conffile = VMD_CONF;
enum privsep_procid proc_id = PROC_PARENT;
int proc_instance = 0, vm_launch = 0, vm_fd = -1;
const char *errp, *title = NULL;