[hurd,commited] hurd: Fix tst-openloc

Message ID 20230720214434.2082946-1-samuel.thibault@ens-lyon.org
State Committed
Commit f7f181c12c140ff1fe45376b98fe32eb491e363f
Headers
Series [hurd,commited] hurd: Fix tst-openloc |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch fail Patch failed to apply to master at the time it was sent
redhat-pt-bot/TryBot-32bit fail Patch series failed to apply
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 warning Patch failed to apply
linaro-tcwg-bot/tcwg_glibc_build--master-arm warning Patch failed to apply
linaro-tcwg-bot/tcwg_glibc_check--master-arm warning Patch failed to apply
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 warning Patch failed to apply

Commit Message

Samuel Thibault July 20, 2023, 9:44 p.m. UTC
  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(-)
  

Patch

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);
     }