If debug state in the logging routines isn't set, messages from
fatal{,x} and warn{,x} don't get flushed to stderr, so running vmd
un-daemonized can result in the process exiting at startup with no
discernable message reason other than the ambiguous exit code (1).

OK?

Index: vmd.c
===================================================================
RCS file: /cvs/src/usr.sbin/vmd/vmd.c,v
retrieving revision 1.123
diff -u -p -r1.123 vmd.c
--- vmd.c       26 Apr 2021 22:58:27 -0000      1.123
+++ vmd.c       4 May 2021 00:44:56 -0000
@@ -802,6 +802,9 @@ main(int argc, char **argv)
        if (env->vmd_noaction && !env->vmd_debug)
                env->vmd_debug = 1;

+       log_init(env->vmd_debug, LOG_DAEMON);
+       log_setverbose(env->vmd_verbose);
+
        /* check for root privileges */
        if (env->vmd_noaction == 0) {
                if (geteuid())
@@ -835,9 +838,6 @@ main(int argc, char **argv)

        /* Configuration will be parsed after forking the children */
        env->vmd_conffile = conffile;
-
-       log_init(env->vmd_debug, LOG_DAEMON);
-       log_setverbose(env->vmd_verbose);

        if (env->vmd_noaction)
                ps->ps_noaction = 1;

Reply via email to