Blob Blame History Raw
diff -up cups-1.6.3/backend/socket.c.multifile-stuck cups-1.6.3/backend/socket.c
--- cups-1.6.3/backend/socket.c.multifile-stuck	2018-12-14 13:18:17.714146640 +0100
+++ cups-1.6.3/backend/socket.c	2018-12-14 13:20:15.781155072 +0100
@@ -430,8 +430,10 @@ main(int  argc,				/* I - Number of comm
       lseek(print_fd, 0, SEEK_SET);
     }
 
-    tbytes = backendRunLoop(print_fd, device_fd, snmp_fd, &(addrlist->addr), 1,
-                            0, backendNetworkSideCB);
+    if ((bytes = backendRunLoop(print_fd, device_fd, snmp_fd, &(addrlist->addr), 1, 0, backendNetworkSideCB)) < 0)
+      tbytes = -1;
+    else
+      tbytes = bytes;
 
     if (print_fd != 0 && tbytes >= 0)
       _cupsLangPrintFilter(stderr, "INFO", _("Print file sent."));
@@ -448,7 +450,7 @@ main(int  argc,				/* I - Number of comm
       break;
 #endif /* __APPLE__ */
 
-  if (waiteof)
+  if (waiteof && tbytes >= 0)
   {
    /*
     * Shutdown the socket and wait for the other end to finish...
@@ -485,7 +487,7 @@ main(int  argc,				/* I - Number of comm
   if (print_fd != 0)
     close(print_fd);
 
-  return (CUPS_BACKEND_OK);
+  return (tbytes >= 0 ? CUPS_BACKEND_OK : CUPS_BACKEND_FAILED);
 }
 
 
diff -up cups-1.6.3/scheduler/main.c.multifile-stuck cups-1.6.3/scheduler/main.c
--- cups-1.6.3/scheduler/main.c.multifile-stuck	2018-12-14 13:18:17.707146699 +0100
+++ cups-1.6.3/scheduler/main.c	2018-12-14 13:18:17.726146539 +0100
@@ -1855,9 +1855,16 @@ process_children(void)
               (!job->filters[i] && WIFEXITED(old_status)))
           {				/* Backend and filter didn't crash */
 	    if (job->filters[i])
+	    {
 	      job->status = status;	/* Filter failed */
+	    }
 	    else
+	    {
 	      job->status = -status;	/* Backend failed */
+
+	      if (job->current_file < job->num_files)
+	        cupsdSetJobState(job, IPP_JOB_ABORTED, CUPSD_JOB_FORCE, "Canceling multi-file job due to backend failure.");
+	    }
           }
 
 	  if (job->state_value == IPP_JOB_PROCESSING &&