Another lseek bug on BeOS.
authorBruno Haible <bruno@clisp.org>
Sun, 19 Aug 2007 09:10:56 +0000 (09:10 +0000)
committerBruno Haible <bruno@clisp.org>
Sun, 19 Aug 2007 09:10:56 +0000 (09:10 +0000)
ChangeLog
doc/functions/lseek.texi
tests/test-lseek.c

index d863bebb6bde8b1ba5591bf0b17d2f3291ac043d..db9f1f9db14763ccebeedc885ca748a5db1d1763 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
-2007-08-18  Bruno Haible  <bruno@clisp.org>
+2007-08-19  Bruno Haible  <bruno@clisp.org>
+
+       * tests/test-lseek.c (main): Disable a test for BeOS.
+       * doc/functions/lseek.texi: Document the BeOS bug.
+
+2007-08-19  Bruno Haible  <bruno@clisp.org>
             Eric Blake  <ebb9@byu.net>
 
        * lib/lseek.c: Include <sys/stat.h>.
index 1f214d18c42b515b82f905ebc81f3db8c3c0c3ae..16c2dfa5b8279b3ff26e57828b615767de4c41d5 100644 (file)
@@ -27,4 +27,9 @@ When the third argument is invalid, POSIX says that @code{lseek} should set
 @code{errno} to @code{EINVAL} and return -1, but in this situation a
 @code{SIGSYS} signal is raised on some platforms:
 IRIX 6.5.
+@item
+When the @code{lseek} function fails, POSIX says that the file offset remains
+unchanged.  But on some platforms, attempting to set a negative file offset
+fails and sets the file offset to 0:
+BeOS.
 @end itemize
index f1f956e995083afd5e8589de1c3c9f09612546a2..1948920a4a6a3cb9e700b9a3f97407e09d90daae 100644 (file)
@@ -49,7 +49,11 @@ main (int argc, char **argv)
       ASSERT (lseek (0, (off_t)-4, SEEK_CUR) == -1);
       ASSERT (errno == EINVAL);
       errno = 0;
+#if ! defined __BEOS__
+      /* POSIX says that the last lseek call, when failing, does not change
+        the current offset.  But BeOS sets it to 0.  */
       ASSERT (lseek (0, (off_t)0, SEEK_CUR) == 2);
+#endif
 #if 0 /* leads to SIGSYS on IRIX 6.5 */
       ASSERT (lseek (0, (off_t)0, (SEEK_SET | SEEK_CUR | SEEK_END) + 1) == -1);
       ASSERT (errno == EINVAL);
@@ -59,7 +63,11 @@ main (int argc, char **argv)
       ASSERT (lseek (1, (off_t)-4, SEEK_CUR) == -1);
       ASSERT (errno == EINVAL);
       errno = 0;
+#if ! defined __BEOS__
+      /* POSIX says that the last lseek call, when failing, does not change
+        the current offset.  But BeOS sets it to 0.  */
       ASSERT (lseek (1, (off_t)0, SEEK_CUR) == 2);
+#endif
 #if 0 /* leads to SIGSYS on IRIX 6.5 */
       ASSERT (lseek (1, (off_t)0, (SEEK_SET | SEEK_CUR | SEEK_END) + 1) == -1);
       ASSERT (errno == EINVAL);