1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-12 13:18:14 +03:00

switch-root: umount the old root correctly

The unmount occurs after the pivot_root, so the path used to unmount
should take into account the new root directory. This will allow the
umount to actually succeed.
This commit is contained in:
Dan Dedrick 2014-07-29 15:31:23 -04:00 committed by Zbigniew Jędrzejewski-Szmek
parent 4212a3375e
commit 23f25b1496
Notes: Lennart Poettering 2014-08-19 21:02:56 +02:00
Backport: bugfix

View File

@ -129,8 +129,8 @@ int switch_root(const char *new_root) {
/* Immediately get rid of the old root. Since we are
* running off it we need to do this lazily. */
if (umount2(temporary_old_root, MNT_DETACH) < 0) {
log_error("Failed to umount old root dir %s: %m", temporary_old_root);
if (umount2("/mnt", MNT_DETACH) < 0) {
log_error("Failed to umount old root dir /mnt: %m");
return -errno;
}