From 79719b538693c10cf8881da4357dd16a1117af34 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Mon, 24 Mar 2008 10:13:49 +0000 Subject: [PATCH] Fix adding services to the boot runlevel, #43 --- src/librc/librc.c | 11 ++++++----- 1 file 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; }