summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-06-18 20:01:01 +0200
committerLennart Poettering <lennart@poettering.net>2010-06-18 20:01:01 +0200
commit2cb1a60d14f869023652482a380ca7b659dcf78f (patch)
tree735765c04ca08385bbea73687e9257288295fd9e /src/main.c
parent629c210d3f080854d2d90386f9da1423e53e114e (diff)
init: call telinit in case we are run as init and not pid1
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 99f6bdd712..8a7f18ea9c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -610,6 +610,16 @@ int main(int argc, char *argv[]) {
FDSet *fds = NULL;
bool reexecute = false;
+ if (getpid() != 1 && strstr(program_invocation_short_name, "init")) {
+ /* This is compatbility support for SysV, where
+ * calling init as a user is identical to telinit. */
+
+ errno = -ENOENT;
+ execv(SYSTEMCTL_BINARY_PATH, argv);
+ log_error("Failed to exec " SYSTEMCTL_BINARY_PATH ": %m");
+ return 1;
+ }
+
log_show_color(true);
log_show_location(false);
log_set_max_level(LOG_DEBUG);