This is the mail archive of the glibc-bugs@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug linuxthreads/133] New: sem_timedwait is not POSIX compliant.


The implementation of sem_timedwait which is in semaphore.c, is not POSIX 
compliant in regards to returning errors.  It is supposed to return 0 or -1, and 
put the error in errno, which it doesn't do, but instead returns the error 
directly.  Below is the patch to the latest in CVS.

--- semaphore.c.orig    2004-04-26 14:29:11.000000000 -0400
+++ semaphore.c 2004-04-26 14:30:19.000000000 -0400
@@ -225,7 +225,8 @@
     /* The standard requires that if the function would block and the
        time value is illegal, the function returns with an error.  */
     __pthread_unlock(&sem->__sem_lock);
-    return EINVAL;
+    errno = EINVAL;
+    return -1;
   }

   /* Set up extrication interface */
@@ -263,7 +264,8 @@

        if (was_on_queue) {
          __pthread_set_own_extricate_if(self, 0);
-         return ETIMEDOUT;
+        errno = ETIMEDOUT;
+        return -1;
        }

        /* Eat the outstanding restart() from the signaller */

-- 
           Summary: sem_timedwait is not POSIX compliant.
           Product: glibc
           Version: 2.3.2
            Status: NEW
          Severity: normal
          Priority: P2
         Component: linuxthreads
        AssignedTo: gotom at debian dot or dot jp
        ReportedBy: brian at shoptalkforums dot com
                CC: glibc-bugs at sources dot redhat dot com


http://sources.redhat.com/bugzilla/show_bug.cgi?id=133

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]