diff options
Diffstat (limited to 'src/librc')
-rw-r--r-- | src/librc/librc.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/librc/librc.c b/src/librc/librc.c index 788dcfa5..ac183773 100644 --- a/src/librc/librc.c +++ b/src/librc/librc.c @@ -906,13 +906,14 @@ bool rc_service_add(const char *runlevel, const char *service) /* We need to ensure that only things in /etc/init.d are added * to the boot runlevel */ if (strcmp (runlevel, RC_LEVEL_BOOT) == 0) { - free(init); - p = realpath(dirname (init), path); - if (! *p) + p = realpath(dirname(init), path); + if (! *p) { + free(init); return false; - retval = (strcmp(path, RC_INITDIR) == 0); - if (! retval) { + } + if (strcmp(path, RC_INITDIR) != 0) { + free(init); errno = EPERM; return false; } |