comparison src/sound.c @ 63:12894b62d206

[gaim-migrate @ 73] Added check to make sure we really can open /dev/audio committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Mon, 27 Mar 2000 03:16:21 +0000
parents 2846a03bda67
children b1d7336cba85
comparison
equal deleted inserted replaced
62:03b65653798b 63:12894b62d206
25 #include <unistd.h> 25 #include <unistd.h>
26 #include <gtk/gtk.h> 26 #include <gtk/gtk.h>
27 #include <fcntl.h> 27 #include <fcntl.h>
28 #include <sys/wait.h> 28 #include <sys/wait.h>
29 #include <sys/signal.h> 29 #include <sys/signal.h>
30 #include <unistd.h>
31 #include <sys/types.h>
32 #include <sys/stat.h>
30 33
31 #ifdef ESD_SOUND 34 #ifdef ESD_SOUND
32 #include <esd.h> 35 #include <esd.h>
33 #endif 36 #endif
34 37
54 close(fd); 57 close(fd);
55 } 58 }
56 59
57 static int can_play_audio() 60 static int can_play_audio()
58 { 61 {
59 /* FIXME check for write access and such. */ 62 struct stat *stat_buf;
60 return 1; 63 uid_t user = getuid();
61 64 gid_t group = getgid();
65 if (stat("/dev/audio", stat_buf))
66 return 0;
67 if (user == stat_buf->st_uid && stat_buf->st_mode & S_IWUSR)
68 return 1;
69 if (group == stat_buf->st_gid && stat_buf->st_mode & S_IWGRP)
70 return 1;
71 if (stat_buf->st_mode & S_IWOTH)
72 return 1;
73 return 0;
62 } 74 }
63 75
64 76
65 #ifdef ESD_SOUND 77 #ifdef ESD_SOUND
66 /* 78 /*