# HG changeset patch # User Eric Warmenhoven # Date 954126981 0 # Node ID 12894b62d2064c42803ef20e9d1f7d7411fcaa5a # Parent 03b65653798bb45b1867e4657eca2e400a9aced3 [gaim-migrate @ 73] Added check to make sure we really can open /dev/audio committer: Tailor Script diff -r 03b65653798b -r 12894b62d206 src/sound.c --- a/src/sound.c Mon Mar 27 01:09:13 2000 +0000 +++ b/src/sound.c Mon Mar 27 03:16:21 2000 +0000 @@ -27,6 +27,9 @@ #include #include #include +#include +#include +#include #ifdef ESD_SOUND #include @@ -56,9 +59,18 @@ static int can_play_audio() { - /* FIXME check for write access and such. */ - return 1; - + struct stat *stat_buf; + uid_t user = getuid(); + gid_t group = getgid(); + if (stat("/dev/audio", stat_buf)) + return 0; + if (user == stat_buf->st_uid && stat_buf->st_mode & S_IWUSR) + return 1; + if (group == stat_buf->st_gid && stat_buf->st_mode & S_IWGRP) + return 1; + if (stat_buf->st_mode & S_IWOTH) + return 1; + return 0; }