| 1 |
Fromscip-debian debian hplip 3.26.4+dfsg0-2 hplip/patches/`0049-Avoid-busy-loop-in-hpcups-when-backend-has-exited.patch`#From.: Tim Waugh <[email protected]scip-debian . . . identity/`[email protected]`.> |
| 2 |
Datescip-debian debian hplip 3.26.4+dfsg0-2 hplip/patches/`0049-Avoid-busy-loop-in-hpcups-when-backend-has-exited.patch`#Date.: Fri, 31 Jan 2020 12:35:31 +0100 |
| 3 |
Subjectscip-debian debian hplip 3.26.4+dfsg0-2 hplip/patches/`0049-Avoid-busy-loop-in-hpcups-when-backend-has-exited.patch`#Subject.: Avoid busy loop in hpcups when backend has exited |
| 4 |
|
| 5 |
Origin: https://src.fedoraproject.org/rpms/hplip/blob/master/f/hplip-hpcups-sigpipe.patch |
| 6 |
--- |
| 7 |
prnt/hpijs/services.cpp | 11 ++++++++++- |
| 8 |
1 file changed, 10 insertions(+), 1 deletion(-) |
| 9 |
|
| 10 |
diff --git a/prnt/hpijs/services.cppscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`prnt/hpijs/services.cpp`: b/prnt/hpijs/services.cppscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`prnt/hpijs/services.cpp`: |
| 11 |
index 026ef1a..2938c8d 100644 |
| 12 |
--- a/prnt/hpijs/services.cpp |
| 13 |
+++ b/prnt/hpijs/services.cpp |
| 14 |
@@ -29,6 +29,7 @@ |
| 15 |
POSSIBILITY OF SUCH DAMAGE. |
| 16 |
\*****************************************************************************/ |
| 17 |
|
| 18 |
+#include <errno.h> |
| 19 |
#include <sys/stat.h> |
| 20 |
#include <stdio.h> |
| 21 |
#include <stdlib.h> |
| 22 |
@@ -385,8 +386,16 @@ DRIVER_ERROR UXServices::ToDevice(const BYTE * pBuffer, DWORD * Count) |
| 23 |
if (write(OutputPath, pBuffer, *Count) != (ssize_t)*Count) |
| 24 |
{ |
| 25 |
static int cnt=0; |
| 26 |
|
| 27 |
+ if (cnt < 5) |
| 28 |
+ { |
| 29 |
+ cnt++; |
| 30 |
BUG("unable to write to output, fd=%d, count=%d: %m\n", OutputPath, *Count); |
| 31 |
+ } |
| 32 |
+ |
| 33 |
+ if (errno == EPIPE) |
| 34 |
+ /* The backend has exited. There's no recovering from that. */ |
| 35 |
+ exit (1); |
| 36 |
+ |
| 37 |
return IO_ERROR; |
| 38 |
} |
| 39 |
|