]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Readd O_LARGEFILE flag for openat64 (bug 18781)
authorAndreas Schwab <schwab@suse.de>
Mon, 10 Aug 2015 12:12:47 +0000 (14:12 +0200)
committerAndreas Schwab <schwab@suse.de>
Mon, 10 Aug 2015 16:10:19 +0000 (18:10 +0200)
ChangeLog
NEWS
io/test-lfs.c
sysdeps/unix/sysv/linux/openat.c

index 993022bed3ae220b5309f5d43278caa2d02dac4f..3c30529b728946495c239bd55dd447028eb36c81 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2015-08-10  Andreas Schwab  <schwab@suse.de>
+
+       [BZ #18781]
+       * sysdeps/unix/sysv/linux/openat.c (__OPENAT) [MORE_OFLAGS]: Add
+       MORE_OFLAGS to oflag.
+       * io/test-lfs.c (do_test): Test openat64.
+
 2015-08-10  Joseph Myers  <joseph@codesourcery.com>
 
        [BZ #18789]
diff --git a/NEWS b/NEWS
index 2ee38614caf24dbebf1cbb0b00c24a708765f0e0..ef7e1a9f8f9258184ada936df31e6ef912ff528e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,7 +10,7 @@ Version 2.23
 * The following bugs are resolved with this release:
 
   16517, 16519, 17905, 18265, 18480, 18525, 18618, 18647, 18661, 18674,
-  18787, 18789.
+  18781, 18787, 18789.
 \f
 Version 2.22
 
index 539c2a2b14c3f7876a03e87678d4bc32ec9993d0..b6ebae403c850bc0db852121af930d6f6ebab86d 100644 (file)
@@ -144,7 +144,7 @@ test_ftello (void)
 int
 do_test (int argc, char *argv[])
 {
-  int ret;
+  int ret, fd2;
   struct stat64 statbuf;
 
   ret = lseek64 (fd, TWO_GB+100, SEEK_SET);
@@ -195,6 +195,25 @@ do_test (int argc, char *argv[])
     error (EXIT_FAILURE, 0, "stat reported size %lld instead of %lld.",
           (long long int) statbuf.st_size, (TWO_GB + 100 + 5));
 
+  fd2 = openat64 (AT_FDCWD, name, O_RDWR);
+  if (fd2 == -1)
+    {
+      if (errno == ENOSYS)
+       {
+         /* Silently ignore this test.  */
+         error (0, 0, "openat64 is not supported");
+       }
+      else
+       error (EXIT_FAILURE, errno, "openat64 failed to open big file");
+    }
+  else
+    {
+      ret = close (fd2);
+
+      if (ret == -1)
+       error (EXIT_FAILURE, errno, "error closing file");
+    }
+
   test_ftello ();
 
   return 0;
index 677712330e8a01fc39c873b11a07224e5e73ee14..ad8e31d6cfc6d30104894a0c6df0ed37b205bb66 100644 (file)
@@ -68,6 +68,11 @@ __OPENAT (int fd, const char *file, int oflag, ...)
       va_end (arg);
     }
 
+  /* We have to add the O_LARGEFILE flag for openat64.  */
+#ifdef MORE_OFLAGS
+  oflag |= MORE_OFLAGS;
+#endif
+
   return SYSCALL_CANCEL (openat, fd, file, oflag, mode);
 }
 libc_hidden_def (__OPENAT)