We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 633

Summary: Incorrect use of the kill($pid, 0) idiom.
Product: SDL Reporter: Michael Stone <michael>
Component: audioAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: x86   
OS: Linux   
URL: http://dev.laptop.org/ticket/8307

Description Michael Stone 2008-09-25 19:27:29 UTC
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.
Comment 1 Sam Lantinga 2009-02-16 21:18:19 UTC
Thanks, this is fixed in revision 4433.