$OpenBSD: patch-src_rmd_capture_sound_c,v 1.2 2010/07/01 10:10:09 jakemsr Exp $

Include missing header to prevent 64-bit issues.

sndio

--- src/rmd_capture_sound.c.orig	Sat Dec 13 08:00:34 2008
+++ src/rmd_capture_sound.c	Thu May  6 17:53:12 2010
@@ -33,6 +33,7 @@
 
 #include <pthread.h>
 #include <string.h>
+#include <stdlib.h>
 #include <errno.h>
 
 
@@ -79,7 +80,7 @@ void *CaptureSound(ProgData *pdata){
                 }
             }
 #else
-            close(pdata->sound_handle);
+            sio_close(pdata->sound_handle);
             pthread_mutex_lock(&pdata->pause_mutex);
             pthread_cond_wait(&pdata->pause_cond, &pdata->pause_mutex);
             pthread_mutex_unlock(&pdata->pause_mutex);
@@ -87,7 +88,7 @@ void *CaptureSound(ProgData *pdata){
                 OpenDev(pdata->args.device,
                         pdata->args.channels,
                         pdata->args.frequency);
-            if(pdata->sound_handle<0){
+            if(pdata->sound_handle==NULL){
                 fprintf(stderr,"Couldn't reopen sound device.Exiting\n");
                 pdata->running = FALSE;
                 errno=3;
@@ -130,15 +131,13 @@ void *CaptureSound(ProgData *pdata){
         sret=0;
         //oss recording loop
         do{
-            int temp_sret=read(pdata->sound_handle,
+            int temp_sret=sio_read(pdata->sound_handle,
                                &newbuf->data[sret],
                                ((pdata->args.buffsize<<1)*
                                 pdata->args.channels)-sret);
-            if(temp_sret<0){
+            if(temp_sret==0 && sio_eof(pdata->sound_handle)){
                 fprintf(stderr,"An error occured while reading from soundcard"
-                               "%s\n"
-                               "Error description:\n"
-                               "%s\n",pdata->args.device,strerror(errno));
+                               "%s\n",pdata->args.device);
             }
             else
                 sret+=temp_sret;
@@ -166,7 +165,7 @@ void *CaptureSound(ProgData *pdata){
 #ifdef HAVE_LIBASOUND
     snd_pcm_close(pdata->sound_handle);
 #else
-    close(pdata->sound_handle);
+    sio_close(pdata->sound_handle);
 #endif
     pthread_exit(&errno);
 }
