> The problem here is that if for whatever reason the soundserver has not
> finished initializing after 1 second (perhaps heavy CPU load, slow
> machine, and/or just odd process scheduling), then the kill() test
> returns a false positive, and if the soundserver exits afterwards, the
> main process would be talking to a broken pipe. Also, SIGPIPE is ignored
> and EPIPE is not checked for after write()'s, so this condition never
> gets caught.

This looks fairly easy to check for, with something like the patch below.
This bug is easy to recreate:  start xgalaga, make sure the sound is
working, pause the game and kill sndserver from a separate window, unpause
and wait for/cause a sound to play, crash.  I suppose it would be enough
to simply ignore the signal (which we don't seem to do, the above text
must be outdated now) but checking the write() return and actually
disabling sound feels more complete.



diff -ru xgalaga-2.0.34.orig/sound.c xgalaga-2.0.34/sound.c
--- xgalaga-2.0.34.orig/sound.c 2005-05-26 09:21:23.208840000 -0700
+++ xgalaga-2.0.34/sound.c      2005-05-26 09:44:00.152553680 -0700
@@ -46,6 +46,7 @@
          return;

   signal(SIGCHLD, SIG_IGN);
+  signal(SIGPIPE, SIG_IGN);

   if(unixSoundPath[0] == '?')  {
       audioOK = 0;
@@ -88,7 +89,11 @@
   char c;

   c = k;
-  if ((playSounds) && (audioOK)) write (soundfd, &c, sizeof (c));
+  if ((playSounds) && (audioOK)) {
+         if(write (soundfd, &c, sizeof (c)) == -1) {
+                 audioOK = 0;
+         }
+  }
 }








--
Paul Telford | 1024D/431B38BA | [EMAIL PROTECTED] | [EMAIL PROTECTED]
       C903 0E85 9AF5 1B80 6A5F  F169 D7E9 4363 431B 38BA



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to