From 1367809142ae42d8c73464cc8cceaa7cad772d86 Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Sat, 13 May 2023 18:13:31 +0200 Subject: [PATCH] LibCore: Fix logic deciding when to open files in non-blocking mode The if statement for setting the O_NONBLOCK flag was written the other way around, causing Core::File to open files in non-blocking mode, when we didn't actually specify it. --- Userland/Libraries/LibCore/File.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibCore/File.cpp b/Userland/Libraries/LibCore/File.cpp index 2d9cec95cd9..be65e1ddc18 100644 --- a/Userland/Libraries/LibCore/File.cpp +++ b/Userland/Libraries/LibCore/File.cpp @@ -85,7 +85,7 @@ int File::open_mode_to_options(OpenMode mode) flags |= O_EXCL; if (!has_flag(mode, OpenMode::KeepOnExec)) flags |= O_CLOEXEC; - if (!has_flag(mode, OpenMode::Nonblocking)) + if (has_flag(mode, OpenMode::Nonblocking)) flags |= O_NONBLOCK; // Some open modes, like `ReadWrite` imply the ability to create the file if it doesn't exist.