systemd/0050-switch_root-do-not-fai...

42 lines
1.6 KiB
Diff

From 70a3ef63810ef3c7970871c1b1e1e060110ecfa6 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 3 Sep 2014 13:31:25 +0200
Subject: [PATCH] switch_root: do not fail, if base_filesystem_create() failed
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.
base_filesystem_create() should have logged, what went wrong.
(cherry picked from commit 6d0f91bf551464c57bc12f99deccd515fb3f628d)
---
src/shared/switch-root.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/src/shared/switch-root.c b/src/shared/switch-root.c
index bac0e5c349..1a558b897b 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,7 @@ 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;
- }
+ (void) base_filesystem_create(new_root);
if (chdir(new_root) < 0) {
log_error("Failed to change directory to %s: %m", new_root);