]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
hurd: Fix tst-openloc
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Thu, 20 Jul 2023 21:38:24 +0000 (23:38 +0200)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Thu, 20 Jul 2023 21:42:56 +0000 (23:42 +0200)
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

index 5b3c1849efa6a3a502077a9a6a518fa79e530239..51a485c19419e95028d41cfa217906aaf8bedd49 100644 (file)
@@ -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);
     }