summaryrefslogtreecommitdiff
path: root/io/test-lfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'io/test-lfs.c')
-rw-r--r--io/test-lfs.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/io/test-lfs.c b/io/test-lfs.c
index 3088a21fd8..f7721a5995 100644
--- a/io/test-lfs.c
+++ b/io/test-lfs.c
@@ -1,5 +1,5 @@
/* Some basic tests for LFS.
- Copyright (C) 2000-2016 Free Software Foundation, Inc.
+ Copyright (C) 2000-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 2000.
@@ -53,7 +53,7 @@ do_prepare (int argc, char *argv[])
struct rlimit64 rlim;
name_len = strlen (test_dir);
- name = malloc (name_len + sizeof ("/lfsXXXXXX"));
+ name = xmalloc (name_len + sizeof ("/lfsXXXXXX"));
mempcpy (mempcpy (name, test_dir, name_len),
"/lfsXXXXXX", sizeof ("/lfsXXXXXX"));
@@ -163,6 +163,27 @@ do_test (int argc, char *argv[])
error (0, errno, "lseek64 failed with error");
exit (EXIT_FAILURE);
}
+ off64_t offset64 = lseek64 (fd, 0, SEEK_CUR);
+ if (offset64 != TWO_GB + 100)
+ {
+ error (0, 0, "lseek64 did not return expected offset");
+ exit (EXIT_FAILURE);
+ }
+ off_t offset = lseek (fd, 0, SEEK_CUR);
+ if (sizeof (off_t) < sizeof (off64_t))
+ {
+ if (offset != -1 || errno != EOVERFLOW)
+ {
+ error (0, 0, "lseek did not fail with EOVERFLOW");
+ exit (EXIT_FAILURE);
+ }
+ }
+ else
+ if (offset != TWO_GB + 100)
+ {
+ error (0, 0, "lseek did not return expected offset");
+ exit (EXIT_FAILURE);
+ }
ret = write (fd, "Hello", 5);
if (ret == -1 && errno == EFBIG)