diff options
author | Roy Marples <roy@marples.name> | 2008-01-30 12:50:44 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2008-01-30 12:50:44 +0000 |
commit | 4bdfccc2c2b2fa67d52f62e62775fc00cb5c0599 (patch) | |
tree | 9d5633559cf36c1a4efdb385283bdfe99b2d8cbf | |
parent | c1d18354c6a5061490f9ca892b7872d5f11e153f (diff) |
Fix adding net scripts to the boot runlevel.
-rw-r--r-- | src/librc/librc.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/librc/librc.c b/src/librc/librc.c index 7093ddab..dbbdbb5e 100644 --- a/src/librc/librc.c +++ b/src/librc/librc.c @@ -765,18 +765,20 @@ 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) { - char tmp[MAXPATHLEN]; + char tmp[MAXPATHLEN] = { '\0' }; + char *p; - if (! realpath (init, tmp)) + p = realpath (dirname (init), tmp); + free (init); + if (! *p) return (false); - retval = (strcmp (dirname (tmp), RC_INITDIR) == 0); + + retval = (strcmp (tmp, RC_INITDIR) == 0); if (! retval) { - free (init); errno = EPERM; return (false); } - free (init); - init = xstrdup (tmp); + init = rc_strcatpaths (RC_INITDIR, service, (char *) NULL); } file = rc_strcatpaths (RC_RUNLEVELDIR, runlevel, basename_c (service), |