X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fmain.c;h=64c2b3f3a143d4248522bb2339689d28e77d1474;hb=671174136525ddf208cdbe75d6d6bd159afa961f;hp=bd148b1b33642c444d13c25ff7cf7687fab2afca;hpb=f07756bfe25c64119704c93a634162d6c88b5c89;p=elogind.git diff --git a/src/core/main.c b/src/core/main.c index bd148b1b3..64c2b3f3a 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -1834,7 +1834,6 @@ finish: if (reexecute) { const char **args; unsigned i, args_size; - sigset_t ss; /* Close and disarm the watchdog, so that the new * instance can reinitialize it, but doesn't get @@ -1854,8 +1853,8 @@ finish: * deserializing. */ broadcast_signal(SIGTERM, false, true); - /* And switch root */ - r = switch_root(switch_root_dir); + /* And switch root with MS_MOVE, because we remove the old directory afterwards and detach it. */ + r = switch_root(switch_root_dir, "/mnt", true, MS_MOVE); if (r < 0) log_error("Failed to switch root, ignoring: %s", strerror(-r)); } @@ -1918,12 +1917,10 @@ finish: args[i++] = NULL; assert(i <= args_size); - /* reenable any blocked signals, especially important + /* Reenable any blocked signals, especially important * if we switch from initial ramdisk to init=... */ reset_all_signal_handlers(); - - assert_se(sigemptyset(&ss) == 0); - assert_se(sigprocmask(SIG_SETMASK, &ss, NULL) == 0); + reset_signal_mask(); if (switch_root_init) { args[0] = switch_root_init;