diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-22 11:40:27 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-22 11:40:27 +0200 |
commit | 7d834c9bb436edd594ebacc48d2b9ea7d3364dbd (patch) | |
tree | 7ef97bae0f9ec9d82c0a2de303f2bf3f7f816819 /util-linux/switch_root.c | |
parent | 753c4045e4f287fc4b4788afd94f58738a7f04b4 (diff) | |
download | busybox-w32-7d834c9bb436edd594ebacc48d2b9ea7d3364dbd.tar.gz busybox-w32-7d834c9bb436edd594ebacc48d2b9ea7d3364dbd.tar.bz2 busybox-w32-7d834c9bb436edd594ebacc48d2b9ea7d3364dbd.zip |
run-init: if doing dry run, do not require pid==1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux/switch_root.c')
-rw-r--r-- | util-linux/switch_root.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/util-linux/switch_root.c b/util-linux/switch_root.c index 16abcb634..080b05e45 100644 --- a/util-linux/switch_root.c +++ b/util-linux/switch_root.c | |||
@@ -227,9 +227,12 @@ int switch_root_main(int argc UNUSED_PARAM, char **argv) | |||
227 | xstat("/", &st); | 227 | xstat("/", &st); |
228 | rootdev = st.st_dev; | 228 | rootdev = st.st_dev; |
229 | xstat(".", &st); | 229 | xstat(".", &st); |
230 | if (st.st_dev == rootdev || getpid() != 1) { | 230 | if (st.st_dev == rootdev) { |
231 | // Show usage, it says new root must be a mountpoint | 231 | // Show usage, it says new root must be a mountpoint |
232 | // and we must be PID 1 | 232 | bb_show_usage(); |
233 | } | ||
234 | if (!dry_run && getpid() != 1) { | ||
235 | // Show usage, it says we must be PID 1 | ||
233 | bb_show_usage(); | 236 | bb_show_usage(); |
234 | } | 237 | } |
235 | 238 | ||