https://github.com/AZero13 updated https://github.com/llvm/llvm-project/pull/176581
>From f70afcb3a0ffe27686e3858a98e0a4a645e28a94 Mon Sep 17 00:00:00 2001 From: AZero13 <[email protected]> Date: Sat, 17 Jan 2026 12:48:30 -0500 Subject: [PATCH] Never consider an fd being 0 as an error This is not semantically right, even if unlikely to happen. --- compiler-rt/lib/fuzzer/afl/afl_driver.cpp | 2 +- libc/src/spawn/linux/posix_spawn.cpp | 2 +- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler-rt/lib/fuzzer/afl/afl_driver.cpp b/compiler-rt/lib/fuzzer/afl/afl_driver.cpp index 52aede7e078dc..7643cf6d5bf0f 100644 --- a/compiler-rt/lib/fuzzer/afl/afl_driver.cpp +++ b/compiler-rt/lib/fuzzer/afl/afl_driver.cpp @@ -154,7 +154,7 @@ static void close_stdout() { discard_output(STDOUT_FILENO); } static void dup_and_close_stderr() { int output_fileno = fileno(output_file); int output_fd = dup(output_fileno); - if (output_fd <= 0) + if (output_fd < 0) abort(); FILE *new_output_file = fdopen(output_fd, "w"); if (!new_output_file) diff --git a/libc/src/spawn/linux/posix_spawn.cpp b/libc/src/spawn/linux/posix_spawn.cpp index fe82ba260148a..f05815805dc05 100644 --- a/libc/src/spawn/linux/posix_spawn.cpp +++ b/libc/src/spawn/linux/posix_spawn.cpp @@ -44,7 +44,7 @@ cpp::optional<int> open(const char *path, int oflags, mode_t mode) { int fd = LIBC_NAMESPACE::syscall_impl<int>(SYS_openat, AT_FDCWD, path, oflags, mode); #endif - if (fd > 0) + if (fd >= 0) return fd; // The open function is called as part of the child process' preparatory // steps. If an open fails, the child process just exits. So, unlike diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index c6261910700cb..4e25ec83a741f 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -271,7 +271,7 @@ static void ParseSupportFilesFromPrologue( auto orig_name = m_file_spec.GetFilename().GetStringRef(); auto ec = llvm::sys::fs::createTemporaryFile( "", llvm::sys::path::filename(orig_name, style), fd, name); - if (ec || fd <= 0) { + if (ec || fd < 0) { LLDB_LOG(GetLog(DWARFLog::DebugInfo), "Could not create temporary file"); return tmp_file; _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
