[Bug 1409922] [NEW] libsdl 1.2 SDL_SemWaitTimeout incorrect behavior
Darrell Walisser
darrell.walisser at gmail.com
Mon Jan 12 21:39:48 UTC 2015
Public bug reported:
release: 14.04.1 LTS
version: 1.2.15-8ubuntu1.1 0
The function SDL_SemWaitTimeout returns an error result (-1) if the
semaphore wait times out, when it should return SDL_MUTEX_TIMEDOUT per
documentation.
Ref:
http://www.libsdl.org/release/SDL-1.2.15/docs/html/sdlsemwaittimeout.html
The fix is to check for ETIMEDOUT value of errno:
diff -ru libsdl1.2-1.2.15/src/thread/pthread/SDL_syssem.c libsdl1.2-fixed/src/thread/pthread/SDL_syssem.c
--- libsdl1.2-1.2.15/src/thread/pthread/SDL_syssem.c 2012-01-19 01:30:06.000000000 -0500
+++ libsdl1.2-fixed/src/thread/pthread/SDL_syssem.c 2015-01-12 16:13:54.768791640 -0500
@@ -144,8 +144,12 @@
retval = sem_timedwait(&sem->sem, &ts_timeout);
while (retval == -1 && errno == EINTR);
- if (retval == -1)
- SDL_SetError(strerror(errno));
+ if (retval == -1) {
+ if (errno == ETIMEDOUT)
+ retval = SDL_MUTEX_TIMEDOUT;
+ else
+ SDL_SetError(strerror(errno));
+ }
#else
end = SDL_GetTicks() + timeout;
while ((retval = SDL_SemTryWait(sem)) == SDL_MUTEX_TIMEDOUT) {
** Affects: libsdl1.2 (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to libsdl1.2 in Ubuntu.
https://bugs.launchpad.net/bugs/1409922
Title:
libsdl 1.2 SDL_SemWaitTimeout incorrect behavior
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/libsdl1.2/+bug/1409922/+subscriptions
More information about the Ubuntu-server-bugs
mailing list