diff options
author | Andreas Schwab <schwab@suse.de> | 2015-08-10 14:12:47 +0200 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2015-08-12 00:14:06 -0400 |
commit | 6f9b62ae8465ec6cb6561f309a2393899091f1c7 (patch) | |
tree | c95cf0663bde0a0c68766ca95d2cb76ce3dded90 | |
parent | 078cee5a65f59943e2d72e36ba6635d059c38426 (diff) | |
download | glibc-6f9b62ae8465ec6cb6561f309a2393899091f1c7.tar.gz |
Readd O_LARGEFILE flag for openat64 (bug 18781)
(cherry picked from commit eb32b0d40308166c4d8f6330cc2958cb1e545075)
(cherry picked from commit 561a9f11a974a447acb3dd03550a05df701a900e)
-rw-r--r-- | io/test-lfs.c | 21 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/openat.c | 5 |
2 files changed, 25 insertions, 1 deletions
diff --git a/io/test-lfs.c b/io/test-lfs.c index 539c2a2b14..b6ebae403c 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; diff --git a/sysdeps/unix/sysv/linux/openat.c b/sysdeps/unix/sysv/linux/openat.c index 677712330e..ad8e31d6cf 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) |