fuzz: fix error handling of fcntl()

(cherry picked from commit 76f37fd835028177df93d674d9a2f897893af69c)
This commit is contained in:
Yu Watanabe
2026-10-16 17:24:51 +01:00
committed by Luca Boccassi
parent 96be8707ef
commit de6055cf6a
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -112,7 +112,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
if (getenv_bool("SYSTEMD_FUZZ_OUTPUT") <= 0) {
orig_stdout_fd = fcntl(fileno(stdout), F_DUPFD_CLOEXEC, 3);
if (orig_stdout_fd < 0)
log_warning_errno(orig_stdout_fd, "Failed to duplicate fd 1: %m");
log_warning_errno(errno, "Failed to duplicate fd 1, ignoring: %m");
else
assert_se(freopen("/dev/null", "w", stdout));
}
+1 -1
View File
@@ -84,7 +84,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
if (getenv_bool("SYSTEMD_FUZZ_OUTPUT") <= 0) {
orig_stdout_fd = fcntl(fileno(stdout), F_DUPFD_CLOEXEC, 3);
if (orig_stdout_fd < 0)
log_warning_errno(orig_stdout_fd, "Failed to duplicate fd 1: %m");
log_warning_errno(errno, "Failed to duplicate fd 1, ignoring: %m");
else
assert_se(freopen("/dev/null", "w", stdout));
}