Blame SOURCES/hplip-hpcups-sigpipe.patch

7a2b19
diff -up hplip-3.9.8/prnt/hpijs/services.cpp.hpcups-sigpipe hplip-3.9.8/prnt/hpijs/services.cpp
7a2b19
--- hplip-3.9.8/prnt/hpijs/services.cpp.hpcups-sigpipe	2009-08-04 22:35:41.000000000 +0100
7a2b19
+++ hplip-3.9.8/prnt/hpijs/services.cpp	2009-10-29 11:56:23.015022337 +0000
7a2b19
@@ -29,6 +29,7 @@
7a2b19
     POSSIBILITY OF SUCH DAMAGE.
7a2b19
 \*****************************************************************************/
7a2b19
 
7a2b19
+#include <errno.h>
7a2b19
 #include <sys/stat.h>
7a2b19
 #include <stdio.h>
7a2b19
 #include <stdlib.h>
7a2b19
@@ -382,8 +383,16 @@ DRIVER_ERROR UXServices::ToDevice(const 
7a2b19
    if (write(OutputPath, pBuffer, *Count) != (ssize_t)*Count) 
7a2b19
    {
7a2b19
       static int cnt=0;
7a2b19
-      if (cnt++ < 5)
7a2b19
+      if (cnt < 5)
7a2b19
+      {
7a2b19
+	 cnt++;
7a2b19
          BUG("unable to write to output, fd=%d, count=%d: %m\n", OutputPath, *Count);
7a2b19
+      }
7a2b19
+
7a2b19
+      if (errno == EPIPE)
7a2b19
+	 /* The backend has exited.  There's no recovering from that. */
7a2b19
+	 exit (1);
7a2b19
+
7a2b19
       return IO_ERROR;
7a2b19
    }
7a2b19