initctl: add some checks before starting up

This commit is contained in:
Lennart Poettering 2010-06-19 16:56:57 +02:00
parent f5a3628cc7
commit 0ca3f374f9
2 changed files with 20 additions and 0 deletions

View File

@ -336,6 +336,16 @@ int main(int argc, char *argv[]) {
Server server;
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_parse_environment();

View File

@ -535,6 +535,16 @@ int main(int argc, char *argv[]) {
Server server;
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_parse_environment();