File 20-via-kludge.dpatch of Package gramofile

# Patch by Joerg Specht <joerg.specht@ins.uni-stuttgart.de>
# Cleaned up some cruft in @@ lines--weird. [dk]

--- bplaysrc/sndfunc.c	2011-08-14 13:21:45.753217822 +0200
+++ bplaysrc/sndfunc.c	2011-08-14 13:27:15.113717191 +0200
@@ -22,6 +22,7 @@
 
 /* Globals */
 int audio, abuf_size, fmt_mask;
+int audio_recorder;
 
 /* Prototypes */
 void sync_audio(void);
@@ -36,6 +37,7 @@
 void init_sound(int recorder)
 {
     /* Attempt to open the audio device */
+    audio_recorder = recorder;
     audio = open(AUDIO, (recorder)? O_RDONLY : O_WRONLY);
     if (audio == -1)
 	ErrDie(AUDIO);
@@ -76,6 +78,9 @@
 
 void sync_audio(void)
 {
+    /* at least Linux' via82cxxx_audio-driver reports error	*/
+    /* when trying to SNDCTL_DSP_SYNC in O_RDONLY mode		*/
     if (ioctl (audio, SNDCTL_DSP_SYNC, NULL) < 0)
+      if (!audio_recorder)
 	ErrDie(AUDIO);
 }
openSUSE Build Service is sponsored by