]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: don't mkdir state paths in watchfrr
authorDavid Lamparter <equinox@opensourcerouting.org>
Thu, 3 Aug 2017 04:02:45 +0000 (06:02 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Wed, 9 Aug 2017 08:55:03 +0000 (10:55 +0200)
watchfrr doesn't know if there will be -u/-g options on the individual
daemons, so it doesn't know what the appropriate ownership is.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/libfrr.c

index aa21a143bae95d8804356e811b586507e5a292fe..31d93009fa13e86a8514623fa304ac8ec2602665 100644 (file)
@@ -399,12 +399,15 @@ struct thread_master *frr_init(void)
        zlog_set_level(ZLOG_DEST_SYSLOG, zlog_default->default_lvl);
 #endif
 
-       if (!di->pid_file || !di->vty_path)
-               frr_mkdir(frr_vtydir, false);
-       if (di->pid_file)
-               frr_mkdir(di->pid_file, true);
-       if (di->vty_path)
-               frr_mkdir(di->vty_path, true);
+       /* don't mkdir these as root... */
+       if (!(di->flags & FRR_NO_PRIVSEP)) {
+               if (!di->pid_file || !di->vty_path)
+                       frr_mkdir(frr_vtydir, false);
+               if (di->pid_file)
+                       frr_mkdir(di->pid_file, true);
+               if (di->vty_path)
+                       frr_mkdir(di->vty_path, true);
+       }
 
        frrmod_init(di->module);
        while (modules) {