Commit 0ca3f374 authored by Lennart Poettering's avatar Lennart Poettering

initctl: add some checks before starting up

parent f5a3628c
...@@ -336,6 +336,16 @@ int main(int argc, char *argv[]) { ...@@ -336,6 +336,16 @@ int main(int argc, char *argv[]) {
Server server; Server server;
int r = 3, n; int r = 3, n;
if (getppid() != 1) {
log_error("This program should be invoked by init only.");
return 1;
}
if (argc > 1) {
log_error("This program does not take arguments.");
return 1;
}
log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); log_set_target(LOG_TARGET_SYSLOG_OR_KMSG);
log_parse_environment(); log_parse_environment();
......
...@@ -535,6 +535,16 @@ int main(int argc, char *argv[]) { ...@@ -535,6 +535,16 @@ int main(int argc, char *argv[]) {
Server server; Server server;
int r = 3, n; int r = 3, n;
if (getppid() != 1) {
log_error("This program should be invoked by init only.");
return 1;
}
if (argc > 1) {
log_error("This program does not take arguments.");
return 1;
}
log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); log_set_target(LOG_TARGET_SYSLOG_OR_KMSG);
log_parse_environment(); log_parse_environment();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment