Fix error and only let root run init commands except for status and help
This commit is contained in:
parent
53097aedc5
commit
d6c72cc87c
@ -224,11 +224,10 @@ bool rc_mark_service (const char *service, const rc_service_state_t state)
|
|||||||
unlink (file);
|
unlink (file);
|
||||||
i = symlink (init, file);
|
i = symlink (init, file);
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
|
eerror ("symlink `%s' to `%s': %s", init, file, strerror (errno));
|
||||||
free (file);
|
free (file);
|
||||||
free (init);
|
free (init);
|
||||||
free (svc);
|
free (svc);
|
||||||
einfo ("%d %s %s", state, rc_service_state_names[state], base);
|
|
||||||
eerror ("symlink `%s' to `%s': %s", init, file, strerror (errno));
|
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1140,6 +1140,13 @@ int main (int argc, char **argv)
|
|||||||
if (sighup)
|
if (sighup)
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
|
|
||||||
|
if (strcmp (optarg, "status") != 0 &&
|
||||||
|
strcmp (optarg, "help") != 0) {
|
||||||
|
/* Only root should be able to run us */
|
||||||
|
if (geteuid () != 0)
|
||||||
|
eerrorx ("%s: root access required", applet);
|
||||||
|
}
|
||||||
|
|
||||||
/* Export the command we're running.
|
/* Export the command we're running.
|
||||||
This is important as we stamp on the restart function now but
|
This is important as we stamp on the restart function now but
|
||||||
some start/stop routines still need to behave differently if
|
some start/stop routines still need to behave differently if
|
||||||
|
Loading…
Reference in New Issue
Block a user