[pulseaudio-commits] r1164 - /trunk/src/utils/pacat.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Sat Jul 29 08:02:25 PDT 2006


Author: lennart
Date: Sat Jul 29 17:02:24 2006
New Revision: 1164

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1164&root=pulseaudio&view=rev
Log:
handle EOF correctly if it is read before the stream was created

Modified:
    trunk/src/utils/pacat.c

Modified: trunk/src/utils/pacat.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/utils/pacat.c?rev=1164&root=pulseaudio&r1=1163&r2=1164&view=diff
==============================================================================
--- trunk/src/utils/pacat.c (original)
+++ trunk/src/utils/pacat.c Sat Jul 29 17:02:24 2006
@@ -291,18 +291,22 @@
 
     if ((r = read(fd, buffer, l)) <= 0) {
         if (r == 0) {
-            pa_operation *o;
-            
             if (verbose)
                 fprintf(stderr, "Got EOF.\n");
-            
-            if (!(o = pa_stream_drain(stream, stream_drain_complete, NULL))) {
-                fprintf(stderr, "pa_stream_drain(): %s\n", pa_strerror(pa_context_errno(context)));
-                quit(1);
-                return;
-            }
-
-            pa_operation_unref(o);
+
+            if (stream) {
+                pa_operation *o;
+            
+                if (!(o = pa_stream_drain(stream, stream_drain_complete, NULL))) {
+                    fprintf(stderr, "pa_stream_drain(): %s\n", pa_strerror(pa_context_errno(context)));
+                    quit(1);
+                    return;
+                }
+                
+                pa_operation_unref(o);
+            } else
+                quit(0);
+            
         } else {
             fprintf(stderr, "read() failed: %s\n", strerror(errno));
             quit(1);




More information about the pulseaudio-commits mailing list