From 757e397c630b3078b0b3d67f8e901295569d8400 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 19 Aug 2007 09:10:56 +0000 Subject: [PATCH] Another lseek bug on BeOS. --- ChangeLog | 7 ++++++- doc/functions/lseek.texi | 5 +++++ tests/test-lseek.c | 8 ++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d863bebb6b..db9f1f9db1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,9 @@ -2007-08-18 Bruno Haible +2007-08-19 Bruno Haible + + * tests/test-lseek.c (main): Disable a test for BeOS. + * doc/functions/lseek.texi: Document the BeOS bug. + +2007-08-19 Bruno Haible Eric Blake * lib/lseek.c: Include . diff --git a/doc/functions/lseek.texi b/doc/functions/lseek.texi index 1f214d18c4..16c2dfa5b8 100644 --- a/doc/functions/lseek.texi +++ b/doc/functions/lseek.texi @@ -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 diff --git a/tests/test-lseek.c b/tests/test-lseek.c index f1f956e995..1948920a4a 100644 --- a/tests/test-lseek.c +++ b/tests/test-lseek.c @@ -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); -- 2.30.2