[libc-commits] [libc] [libc] Implement freopen (PR #207837)

Jeff Bailey via libc-commits libc-commits at lists.llvm.org
Fri Jul 24 07:28:07 PDT 2026


================
@@ -128,9 +135,9 @@ ErrorOr<LinuxFile *> create_file_from_fd(int fd, const char *mode) {
 
   using OpenMode = File::OpenMode;
   if (((fd_flags & O_ACCMODE) == O_RDONLY &&
-       !(modeflags & static_cast<ModeFlags>(OpenMode::READ))) ||
+       (modeflags & static_cast<ModeFlags>(OpenMode::WRITE))) ||
       ((fd_flags & O_ACCMODE) == O_WRONLY &&
-       !(modeflags & static_cast<ModeFlags>(OpenMode::WRITE)))) {
+       (modeflags & static_cast<ModeFlags>(OpenMode::READ)))) {
     return Error(EINVAL);
   }
----------------
kaladron wrote:

Do you mean the FileMode class?  If yes, can you please file an issue for it? 

https://github.com/llvm/llvm-project/pull/207837


More information about the libc-commits mailing list