aboutsummaryrefslogtreecommitdiff
path: root/src/supervise-daemon/supervise-daemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/supervise-daemon/supervise-daemon.c')
-rw-r--r--src/supervise-daemon/supervise-daemon.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/supervise-daemon/supervise-daemon.c b/src/supervise-daemon/supervise-daemon.c
index 845b118c..e3d4442e 100644
--- a/src/supervise-daemon/supervise-daemon.c
+++ b/src/supervise-daemon/supervise-daemon.c
@@ -817,12 +817,12 @@ int main(int argc, char **argv)
char **child_argv = NULL;
char *str = NULL;
char *cmdline = NULL;
- char *svcdir = RC_SVCDIR;
- char *pidfile_path = "/var/run";
+ char *svcdir = rc_svcdir();
+ char *pidfile_path = xstrdup("/var/run");
#ifdef RC_USER_SERVICES
char *env;
if (rc_is_user()) {
- svcdir = rc_user_svcdir();
+ free(pidfile_path);
if ((env = getenv("XDG_RUNTIME_DIR"))) {
pidfile_path = env;
} else {
@@ -1100,11 +1100,8 @@ int main(int argc, char **argv)
if (!pidfile)
xasprintf(&pidfile, "%s/supervise-%s.pid", pidfile_path, svcname);
xasprintf(&fifopath, "%s/supervise-%s.ctl", svcdir, svcname);
-#ifdef RC_USER_SERVICES
- if (rc_is_user()) {
- free(svcdir);
- }
-#endif
+ free(svcdir);
+ free(pidfile_path);
if (mkfifo(fifopath, 0600) == -1 && errno != EEXIST)
eerrorx("%s: unable to create control fifo: %s",