changeset 9154:0a3b6ec42c55

Another lseek bug on BeOS.
author Bruno Haible <bruno@clisp.org>
date Sun, 19 Aug 2007 09:10:56 +0000
parents f03082407073
children 37e28ffbab9e
files ChangeLog doc/functions/lseek.texi tests/test-lseek.c
diffstat 3 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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>.
--- a/doc/functions/lseek.texi
+++ b/doc/functions/lseek.texi
@@ -27,4 +27,9 @@
 @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
--- a/tests/test-lseek.c
+++ b/tests/test-lseek.c
@@ -49,7 +49,11 @@
       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 @@
       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);