From: Lennart Poettering Date: Wed, 13 Oct 2010 22:49:22 +0000 (+0200) Subject: shutdown: don't chdir to /, since init is running with / as cwd anyway X-Git-Tag: v12~235 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=567ea02a89b358090032c8d1ec89286db07ab2ff;hp=7e23b34c7da85e24c92e984f1d99eead3e9817f5;ds=sidebyside shutdown: don't chdir to /, since init is running with / as cwd anyway --- diff --git a/src/shutdown.c b/src/shutdown.c index b78c74112..3c9a53126 100644 --- a/src/shutdown.c +++ b/src/shutdown.c @@ -36,7 +36,7 @@ #include "umount.h" #include "util.h" -#define TIMEOUT_USEC (5 * USEC_PER_SEC) +#define TIMEOUT_USEC (5 * USEC_PER_SEC) #define FINALIZE_ATTEMPTS 50 #define FINALIZE_CRITICAL_ATTEMPTS 10 @@ -198,7 +198,6 @@ finish: return r; } - int main(int argc, char *argv[]) { int cmd, r, retries; bool need_umount = true, need_swapoff = true, need_loop_detach = true; @@ -208,7 +207,7 @@ int main(int argc, char *argv[]) { log_open(); if (getpid() != 1) { - log_error("Not executed by init (pid-1)."); + log_error("Not executed by init (pid 1)."); r = -EPERM; goto error; } @@ -247,12 +246,7 @@ int main(int argc, char *argv[]) { if (r < 0) log_warning("Cannot send SIGKILL to all process: %s", strerror(r)); - - /* preventing that we won't block umounts */ - if (chdir("/") != 0) - log_warning("Cannot chdir(\"/\"): %m. Unmounts likely to fail."); - - /* umount all mountpoints, swaps, and loopback devices */ + /* Unmount all mountpoints, swaps, and loopback devices */ retries = FINALIZE_ATTEMPTS; while (need_umount || need_swapoff || need_loop_detach) { if (need_umount) {