X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Fswitch-root.c;h=3adb8463c5f373d4cd316c4aab9337d2c3f289a9;hb=c73d180dc4bbd87c945a524b42b672af2ffe2609;hp=bac0e5c34900bd9e48f8ba866191b240db9b776c;hpb=d677d4df80e0ea1c66c691f50867fedd63c6770a;p=elogind.git diff --git a/src/shared/switch-root.c b/src/shared/switch-root.c index bac0e5c34..3adb8463c 100644 --- a/src/shared/switch-root.c +++ b/src/shared/switch-root.c @@ -47,7 +47,6 @@ int switch_root(const char *new_root, const char *oldroot, bool detach_oldroot, struct stat new_root_stat; bool old_root_remove; const char *i, *temporary_old_root; - int r; if (path_equal(new_root, "/")) return 0; @@ -103,11 +102,12 @@ int switch_root(const char *new_root, const char *oldroot, bool detach_oldroot, } } - r = base_filesystem_create(new_root); - if (r < 0) { - log_error("Failed to create the base filesystem: %s", strerror(-r)); - return r; - } + /* Do not fail, if base_filesystem_create() fails. Not all + * switch roots are like base_filesystem_create() wants them + * to look like. They might even boot, if they are RO and + * don't have the FS layout. Just ignore the error and + * switch_root() nevertheless. */ + (void) base_filesystem_create(new_root); if (chdir(new_root) < 0) { log_error("Failed to change directory to %s: %m", new_root);