bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lseek on BeOS (2)


From: Bruno Haible
Subject: lseek on BeOS (2)
Date: Sun, 19 Aug 2007 01:02:22 +0200
User-agent: KMail/1.5.4

Hi Eric,

lseek on BeOS has another deficiency: In some cases it can modify the
file offset although the same call fails. POSIX says this should not happen.
But I don't think it's worth working around it in lib/lseek.c. Here is
instead a proposed workaround for the unit test:

2007-08-18  Bruno Haible  <address@hidden>

        * tests/test-lseek.c (main): Disable a test for BeOS.
        * doc/functions/lseek.texi: Document the BeOS bug.

*** tests/test-lseek.c  2 Jun 2007 00:42:13 -0000       1.4
--- tests/test-lseek.c  18 Aug 2007 22:56:22 -0000
***************
*** 49,55 ****
--- 49,59 ----
        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,65 ****
--- 63,73 ----
        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);
*** doc/functions/lseek.texi    2 Jun 2007 00:42:13 -0000       1.4
--- doc/functions/lseek.texi    18 Aug 2007 22:56:22 -0000
***************
*** 27,30 ****
--- 27,35 ----
  @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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]