mkfs-util: fix error reporting in the mkfs child

`r` at that point holds the return value of `pidref_safe_fork_full()`,
which is 0 in the child, so a failing `setenv()` was reported as
"Success".

Also, fix a stray "°".
This commit is contained in:
Martin Pitt
2026-08-28 07:30:09 +02:00
parent a11144d0a9
commit 6d51f6eb04
+2 -2
View File
@@ -671,14 +671,14 @@ int make_filesystem(
STRV_FOREACH_PAIR(k, v, env)
if (setenv(*k, *v, /* replace= */ true) < 0) {
log_error_errno(r, "Failed to set %s=%s environment variable: %m", *k, *v);
log_error_errno(errno, "Failed to set %s=%s environment variable: %m", *k, *v);
_exit(EXIT_FAILURE);
}
/* mkfs.btrfs refuses to operate on block devices with mounted partitions, even if operating
* on unformatted free space, so let's trick it and other mkfs tools into thinking no
* partitions are mounted. See https://github.com/kdave/btrfs-progs/issues/640 for more
° information. */
* information. */
if (fork_flags & FORK_NEW_MOUNTNS)
(void) mount_nofollow_verbose(LOG_DEBUG, "/dev/null", "/proc/self/mounts", NULL, MS_BIND, NULL);