Blame SOURCES/hplip-hpcups-sigpipe.patch

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