summaryrefslogtreecommitdiffstats
path: root/sys-utils/switch_root.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys-utils/switch_root.c')
-rw-r--r--sys-utils/switch_root.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys-utils/switch_root.c b/sys-utils/switch_root.c
index 1c7375dbe..0da784295 100644
--- a/sys-utils/switch_root.c
+++ b/sys-utils/switch_root.c
@@ -155,11 +155,13 @@ static int switchroot(const char *newroot)
cfd = open("/", O_RDONLY);
if (mount(newroot, "/", NULL, MS_MOVE, NULL) < 0) {
+ close(cfd);
warn(_("failed to mount moving %s to /"), newroot);
return -1;
}
if (chroot(".")) {
+ close(cfd);
warn(_("failed to change root"));
return -1;
}