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 - Incorrect use of the kill($pid, 0) idiom.
Summary: Incorrect use of the kill($pid, 0) idiom.
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: audio (show other bugs)
Version: HG 2.0
Hardware: x86 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL: http://dev.laptop.org/ticket/8307
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-25 19:27 UTC by Michael Stone
Modified: 2009-02-16 21:18 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.