From c5c9d71df333a8c863ed29cb9e60f09b6dfeea4c Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Sat, 24 Jun 2017 16:42:30 -0500 Subject: [PATCH] libc: track O_ACCMODE flags from open Fix #2457 --- repos/libports/src/lib/libc/vfs_plugin.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repos/libports/src/lib/libc/vfs_plugin.cc b/repos/libports/src/lib/libc/vfs_plugin.cc index 5acf6e582f..d384fce907 100644 --- a/repos/libports/src/lib/libc/vfs_plugin.cc +++ b/repos/libports/src/lib/libc/vfs_plugin.cc @@ -230,7 +230,7 @@ Libc::File_descriptor *Libc::Vfs_plugin::open(char const *path, int flags, return nullptr; } - fd->flags = flags & (O_NONBLOCK|O_APPEND); + fd->flags = flags & (O_ACCMODE|O_NONBLOCK|O_APPEND); if ((flags & O_TRUNC) && (ftruncate(fd, 0) == -1)) { errno = EINVAL; /* XXX which error code fits best ? */