shutdown: propagate correct error when remounting fails

Here the logging was fine, but the bogus r == -1 value was propagated
as the return value. The parent then logged
"Remounting '…' failed abnormally, child process … failed: Operation not permitted"
whatever the real error was, and returned -EPERM. Do what
umount_with_timeout() already does with umount2().
This commit is contained in:
Zbigniew Jędrzejewski-Szmek committed 2026-11-04 00:27:14 +01:00
1 parent adc5415edd
commit 8087660ccc
1 file changed
+2 -2
+2 -2
View File
@@ -273,10 +273,10 @@ static int remount_with_timeout(MountPoint *m, bool last_try) {
log_info("Remounting '%s' read-only with options '%s'.", m->path, strempty(m->remount_options));
/* Start the mount operation here in the child */
r = mount(/* source= */ NULL, m->path, /* filesystemtype= */ NULL, m->remount_flags, m->remount_options);
r = RET_NERRNO(mount(/* source= */ NULL, m->path, /* filesystemtype= */ NULL, m->remount_flags, m->remount_options));
if (r < 0)
log_full_errno(last_try ? LOG_ERR : LOG_INFO,
errno,
r,
"Failed to remount '%s' read-only: %m",
m->path);