aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Jaeger <aj@suse.de>2001-02-05 21:38:54 +0000
committerAndreas Jaeger <aj@suse.de>2001-02-05 21:38:54 +0000
commit725c76a6b7ab2ab444d304f89ddecd2227f50f9e (patch)
tree53885d7c429495ee6c5fdbe18709b238c604e490
parentd9bfd1a510a2c83d8f72cb859422f38130be50f9 (diff)
downloadglibc-725c76a6b7ab2ab444d304f89ddecd2227f50f9e.tar
glibc-725c76a6b7ab2ab444d304f89ddecd2227f50f9e.tar.gz
glibc-725c76a6b7ab2ab444d304f89ddecd2227f50f9e.tar.bz2
glibc-725c76a6b7ab2ab444d304f89ddecd2227f50f9e.zip
Update.
* io/test-lfs.c (do_test): Test lseek64 return value, call test_ftello. (test_ftello): New function to test ftello64 and fseeko64.
-rw-r--r--ChangeLog4
-rw-r--r--io/test-lfs.c54
2 files changed, 58 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index bab50bceb7..338853489c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2001-02-05 Andreas Jaeger <aj@suse.de>
+ * io/test-lfs.c (do_test): Test lseek64 return value, call
+ test_ftello.
+ (test_ftello): New function to test ftello64 and fseeko64.
+
* signal/signal.h: Move __sigaction from here to...
* include/signal.h: ...here.
diff --git a/io/test-lfs.c b/io/test-lfs.c
index bfc71f1ac8..a08801f7af 100644
--- a/io/test-lfs.c
+++ b/io/test-lfs.c
@@ -88,6 +88,53 @@ do_prepare (int argc, char *argv[])
}
}
+static void
+test_ftello (void)
+{
+ FILE *f;
+ int ret;
+ off64_t pos;
+
+ f = fopen64 (name, "w");
+
+ ret = fseeko64 (f, TWO_GB+100, SEEK_SET);
+ if (ret == -1 && errno == ENOSYS)
+ {
+ error (0, errno, "fseeko64 is not supported");
+ exit (EXIT_SUCCESS);
+ }
+ if (ret == -1 && errno == EINVAL)
+ {
+ error (0, errno, "LFS seems not to be supported ");
+ exit (EXIT_SUCCESS);
+ }
+ if (ret == -1)
+ {
+ error (0, errno, "fseeko64 failed with error: ");
+ exit (EXIT_FAILURE);
+ }
+
+ ret = fwrite ("Hello", 1, 5, f);
+ if (ret == -1 && errno == EINVAL)
+ {
+ error (0, errno, "LFS seems not to be supported.");
+ exit (EXIT_SUCCESS);
+ }
+
+ if (ret != 5)
+ error (EXIT_FAILURE, errno, "cannot write test string to large file");
+
+ pos = ftello64 (f);
+
+ if (pos != TWO_GB+105)
+ {
+ error (0, 0, "ftello64 gives wrong result.");
+ exit (EXIT_FAILURE);
+ }
+
+ fclose (f);
+}
+
int
do_test (int argc, char *argv[])
{
@@ -105,6 +152,11 @@ do_test (int argc, char *argv[])
error (0, errno, "LFS seems not to be supported ");
exit (EXIT_SUCCESS);
}
+ if (ret == -1)
+ {
+ error (0, errno, "lseek64 failed with error: ");
+ exit (EXIT_FAILURE);
+ }
ret = write (fd, "Hello", 5);
if (ret == -1 && errno == EINVAL)
@@ -131,5 +183,7 @@ 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));
+ test_ftello ();
+
return 0;
}