Skip to content

Commit

Permalink
Readd O_LARGEFILE flag for openat64 (bug 18781)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Schwab committed Aug 10, 2015
1 parent d0649b2 commit eb32b0d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
2 changes: 1 addition & 1 deletion NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Version 2.22

Expand Down
21 changes: 20 additions & 1 deletion io/test-lfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions sysdeps/unix/sysv/linux/openat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit eb32b0d

Please sign in to comment.