comparison src/audio/arts/SDL_artsaudio.c @ 3068:b21348d47cab

Fixed bug #633 Description From Michael Stone 2008-09-25 19:27:29 (-) [reply] To determine whether a pid is occupied with the kill(pid, 0) idiom, you have to test #include <signal.h> #include <errno.h> kill(pid, 0) < 0 && errno == ESRCH not just #include <signal.h> kill(pid, 0) < 0 otherwise you get incorrect results when pid is running as a different user (causing kill(pid, 0) to return -1 + EPERM). src/audio/alsa/SDL_alsa_audio.c is certainly affected by this bug in both 1.2.13 and 1.3-trunk. It probably occurs in other places as well.
author Sam Lantinga <slouken@libsdl.org>
date Tue, 17 Feb 2009 05:17:51 +0000
parents 99210400e8b9
children f7b03b6838cb
comparison
equal deleted inserted replaced
3067:bcd41b269091 3068:b21348d47cab
25 25
26 #ifdef HAVE_SIGNAL_H 26 #ifdef HAVE_SIGNAL_H
27 #include <signal.h> 27 #include <signal.h>
28 #endif 28 #endif
29 #include <unistd.h> 29 #include <unistd.h>
30 #include <errno.h>
30 31
31 #include "SDL_timer.h" 32 #include "SDL_timer.h"
32 #include "SDL_audio.h" 33 #include "SDL_audio.h"
33 #include "../SDL_audiomem.h" 34 #include "../SDL_audiomem.h"
34 #include "../SDL_audio_c.h" 35 #include "../SDL_audio_c.h"
147 /* Note that this only works with thread implementations 148 /* Note that this only works with thread implementations
148 that use a different process id for each thread. 149 that use a different process id for each thread.
149 */ 150 */
150 /* Check every 10 loops */ 151 /* Check every 10 loops */
151 if (this->hidden->parent && (((++cnt) % 10) == 0)) { 152 if (this->hidden->parent && (((++cnt) % 10) == 0)) {
152 if (kill(this->hidden->parent, 0) < 0) { 153 if (kill(this->hidden->parent, 0) < 0 && errno == ESRCH) {
153 this->enabled = 0; 154 this->enabled = 0;
154 } 155 }
155 } 156 }
156 } 157 }
157 158