public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [hurd,commited] hurd: Fix tst-openloc
@ 2023-07-20 21:44 Samuel Thibault
  0 siblings, 0 replies; only message in thread
From: Samuel Thibault @ 2023-07-20 21:44 UTC (permalink / raw)
  To: libc-alpha; +Cc: Samuel Thibault, commit-hurd

On GNU/Hurd, O_RDWR actually is O_WRONLY|O_RDONLY, so checking through
bitness really is wrong. O_ACCMODE is there for this.

Fixes: 5324d258427f ("fileops: Don't process ,ccs= as individual mode flags (BZ#18906)")
---
 libio/tst-fopenloc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libio/tst-fopenloc.c b/libio/tst-fopenloc.c
index 5b3c1849ef..51a485c194 100644
--- a/libio/tst-fopenloc.c
+++ b/libio/tst-fopenloc.c
@@ -76,7 +76,8 @@ do_bz18906 (void)
   if (fp != NULL)
     {
       flags = fcntl (fileno (fp), F_GETFL);
-      retval = (flags & O_RDWR) | (flags & O_WRONLY);
+      retval = ((flags & O_ACCMODE) == O_RDWR);
+      retval |= ((flags & O_ACCMODE) == O_WRONLY);
       TEST_COMPARE (retval, false);
       fclose (fp);
     }
-- 
2.40.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-07-20 21:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-20 21:44 [hurd,commited] hurd: Fix tst-openloc Samuel Thibault

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).