Submitted By:            Bruce Dubbs <bdubbs at linuxfromscratch dot org>
Date:                    2015-11-06
Initial Package Version: 2.22
Upstream Status:         Committted
Origin:                  Upstream Git
Description:             This patch fixes a problem when an application accesses
                         files greater than 2 GB.

X-Git-Url: https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=blobdiff_plain;f=io%2Ftest-lfs.c;h=b6ebae403c850bc0db852121af930d6f6ebab86d;hp=539c2a2b14c3f7876a03e87678d4bc32ec9993d0;hb=561a9f11a974a447acb3dd03550a05df701a900e;hpb=19742d3d5f8fb0cdc95b20c32fbee503d1048286

diff --git a/io/test-lfs.c b/io/test-lfs.c
index 539c2a2..b6ebae4 100644
--- a/io/test-lfs.c
+++ b/io/test-lfs.c
@@ -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;
X-Git-Url: https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=blobdiff_plain;f=sysdeps%2Funix%2Fsysv%2Flinux%2Fopenat.c;h=ad8e31d6cfc6d30104894a0c6df0ed37b205bb66;hp=677712330e8a01fc39c873b11a07224e5e73ee14;hb=561a9f11a974a447acb3dd03550a05df701a900e;hpb=19742d3d5f8fb0cdc95b20c32fbee503d1048286

diff --git a/sysdeps/unix/sysv/linux/openat.c b/sysdeps/unix/sysv/linux/openat.c
index 6777123..ad8e31d 100644
--- a/sysdeps/unix/sysv/linux/openat.c
+++ b/sysdeps/unix/sysv/linux/openat.c
@@ -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)