old_root_remove = in_initrd();
if (stat(new_root, &new_root_stat) < 0) {
old_root_remove = in_initrd();
if (stat(new_root, &new_root_stat) < 0) {
*
* https://bugzilla.redhat.com/show_bug.cgi?id=847418 */
if (mount(NULL, "/", NULL, MS_REC|MS_PRIVATE, NULL) < 0)
*
* https://bugzilla.redhat.com/show_bug.cgi?id=847418 */
if (mount(NULL, "/", NULL, MS_REC|MS_PRIVATE, NULL) < 0)
NULSTR_FOREACH(i, move_mounts) {
char new_mount[PATH_MAX];
NULSTR_FOREACH(i, move_mounts) {
char new_mount[PATH_MAX];
* stat failed. Unmount the old mount
* point. */
if (umount2(i, MNT_DETACH) < 0)
* stat failed. Unmount the old mount
* point. */
if (umount2(i, MNT_DETACH) < 0)
continue;
}
if (mount(i, new_mount, NULL, mountflags, NULL) < 0) {
if (mountflags & MS_MOVE) {
continue;
}
if (mount(i, new_mount, NULL, mountflags, NULL) < 0) {
if (mountflags & MS_MOVE) {
- log_error("Failed to move mount %s to %s, forcing unmount: %m", i, new_mount);
+ log_error_errno(errno, "Failed to move mount %s to %s, forcing unmount: %m", i, new_mount);
- log_error("Failed to bind mount %s to %s: %m", i, new_mount);
+ log_error_errno(errno, "Failed to bind mount %s to %s: %m", i, new_mount);
/* Immediately get rid of the old root, if detach_oldroot is set.
* Since we are running off it we need to do this lazily. */
if (detach_oldroot && umount2(oldroot, MNT_DETACH) < 0)
/* Immediately get rid of the old root, if detach_oldroot is set.
* Since we are running off it we need to do this lazily. */
if (detach_oldroot && umount2(oldroot, MNT_DETACH) < 0)
- log_error("Failed to lazily umount old root dir %s, %s: %m",
+ log_error_errno(errno, "Failed to lazily umount old root dir %s, %s: %m",
oldroot,
errno == ENOENT ? "ignoring" : "leaving it around");
} else if (mount(new_root, "/", NULL, MS_MOVE, NULL) < 0) {
oldroot,
errno == ENOENT ? "ignoring" : "leaving it around");
} else if (mount(new_root, "/", NULL, MS_MOVE, NULL) < 0) {
else {
rm_rf_children(old_root_fd, false, false, &rb);
old_root_fd = -1;
else {
rm_rf_children(old_root_fd, false, false, &rb);
old_root_fd = -1;