chiark / gitweb /
namespace: rework namespace support
[elogind.git] / src / core / switch-root.c
index efc7d345e1a83ca28a861b69eda9b0ee92cac281..150332a8587b841e8bd6a767fe6c8ce50393dbd3 100644 (file)
@@ -115,6 +115,12 @@ int switch_root(const char *new_root) {
                 goto fail;
         }
 
+        if (chdir("/") < 0) {
+                r = -errno;
+                log_error("Failed to change directory: %m");
+                goto fail;
+        }
+
         if (old_root_fd >= 0) {
                 struct stat rb;