Fix adding services to the boot runlevel, #43

This commit is contained in:
Roy Marples 2008-03-24 10:13:49 +00:00
parent 486d517674
commit 79719b5386

View File

@ -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 /* We need to ensure that only things in /etc/init.d are added
* to the boot runlevel */ * to the boot runlevel */
if (strcmp (runlevel, RC_LEVEL_BOOT) == 0) { if (strcmp (runlevel, RC_LEVEL_BOOT) == 0) {
free(init); p = realpath(dirname(init), path);
p = realpath(dirname (init), path); if (! *p) {
if (! *p) free(init);
return false; return false;
retval = (strcmp(path, RC_INITDIR) == 0); }
if (! retval) { if (strcmp(path, RC_INITDIR) != 0) {
free(init);
errno = EPERM; errno = EPERM;
return false; return false;
} }