about summary refs log tree commit homepage
path: root/cfg_validate.c
diff options
context:
space:
mode:
Diffstat (limited to 'cfg_validate.c')
-rw-r--r--cfg_validate.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/cfg_validate.c b/cfg_validate.c
index d07b96c..65001e7 100644
--- a/cfg_validate.c
+++ b/cfg_validate.c
@@ -85,6 +85,26 @@ bool mog_cfg_validate_multi(void *ent_ptr, void *cli_ptr)
         return true;
 }
 
+static void warn_daemonize(size_t *nerr, const char *key, const char *val)
+{
+        warn("%s=%s must use an absolute path", key, val);
+        (*nerr)++;
+}
+
+bool mog_cfg_validate_daemon(void *ent_ptr, void *nerr)
+{
+        struct mog_cfg *ent = ent_ptr;
+
+        if (ent->config&& ent->config[0] != '/')
+                warn_daemonize(nerr, "config", ent->config);
+        if (ent->pidfile && ent->pidfile[0] != '/')
+                warn_daemonize(nerr, "pidfile", ent->pidfile);
+        if (ent->docroot && ent->docroot[0] != '/')
+                warn_daemonize(nerr, "docroot", ent->docroot);
+
+        return true;
+}
+
 static void die_if_set(const void *a, const char *sw)
 {
         if (!a) return;