aboutsummaryrefslogtreecommitdiff
path: root/src/librc/librc-daemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/librc/librc-daemon.c')
-rw-r--r--src/librc/librc-daemon.c39
1 files changed, 6 insertions, 33 deletions
diff --git a/src/librc/librc-daemon.c b/src/librc/librc-daemon.c
index 10bf883a..d44013e5 100644
--- a/src/librc/librc-daemon.c
+++ b/src/librc/librc-daemon.c
@@ -405,12 +405,7 @@ rc_service_daemon_set(const char *service, const char *exec,
RC_STRINGLIST *match;
int i = 0;
FILE *fp;
- char *svcdir = RC_SVCDIR;
-#ifdef RC_USER_SERVICES
- if (rc_is_user()) {
- svcdir = rc_user_svcdir();
- }
-#endif
+ char *svcdir = rc_svcdir();
if (!exec && !pidfile) {
@@ -420,11 +415,7 @@ rc_service_daemon_set(const char *service, const char *exec,
xasprintf(&dirpath, "%s/daemons/%s", svcdir, basename_c(service));
-#ifdef RC_USER_SERVICES
- if (rc_is_user()) {
- free(svcdir);
- }
-#endif
+ free(svcdir);
/* Regardless, erase any existing daemon info */
if ((dp = opendir(dirpath))) {
@@ -490,12 +481,7 @@ rc_service_started_daemon(const char *service,
bool retval = false;
DIR *dp;
struct dirent *d;
- char *svcdir = RC_SVCDIR;
-#ifdef RC_USER_SERVICES
- if (rc_is_user()) {
- svcdir = rc_user_svcdir();
- }
-#endif
+ char *svcdir = rc_svcdir();
if (!service || !exec)
return false;
@@ -503,11 +489,7 @@ rc_service_started_daemon(const char *service,
xasprintf(&dirpath, "%s/daemons/%s", svcdir, basename_c(service));
match = _match_list(exec, argv, NULL);
-#ifdef RC_USER_SERVICES
- if (rc_is_user()) {
- free(svcdir);
- }
-#endif
+ free(svcdir);
if (indx > 0) {
xasprintf(&file, "%03d", indx);
@@ -557,21 +539,12 @@ rc_service_daemons_crashed(const char *service)
size_t i;
char *ch_root;
char *spidfile;
- char *svcdir = RC_SVCDIR;
-#ifdef RC_USER_SERVICES
- if (rc_is_user()) {
- svcdir = rc_user_svcdir();
- }
-#endif
+ char *svcdir = rc_svcdir();
path += snprintf(dirpath, sizeof(dirpath), "%s/daemons/%s",
svcdir, basename_c(service));
-#ifdef RC_USER_SERVICES
- if (rc_is_user()) {
- free(svcdir);
- }
-#endif
+ free(svcdir);
if (!(dp = opendir(dirpath)))
return false;