summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2012-05-22 19:11:10 +0200
committerKay Sievers <kay@vrfy.org>2012-05-22 19:17:40 +0200
commit745e2fb79ab20f3e98310d5e889a161ffe8b492c (patch)
treefa16455dcf0454a371ec0e07993319ee936e3c51 /src
parent898720b7e9cf3bdf7a93e435cbed5dd6942ecf9b (diff)
main: only fall back to /bin/sh in case /sbin/init does not exist
Diffstat (limited to 'src')
-rw-r--r--src/core/main.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/core/main.c b/src/core/main.c
index b66ae0e035..4d9a2d453e 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1749,12 +1749,15 @@ finish:
args[0] = "/sbin/init";
execv(args[0], (char* const*) args);
- log_warning("Failed to execute /sbin/init, trying fallback: %m");
+ if (errno == ENOENT) {
+ log_warning("No /sbin/init, trying fallback");
- args[0] = "/bin/sh";
- args[1] = NULL;
- execv(args[0], (char* const*) args);
- log_error("Failed to execute /bin/sh, giving up: %m");
+ args[0] = "/bin/sh";
+ args[1] = NULL;
+ execv(args[0], (char* const*) args);
+ log_error("Failed to execute /bin/sh, giving up: %m");
+ } else
+ log_warning("Failed to execute /sbin/init, giving up: %m");
}
if (serialization)