pdancak / rpms / cups

Forked from rpms/cups 2 years ago
Clone
8efc740
diff --git a/backend/socket.c b/backend/socket.c
8efc740
index 675061dd9..68379e95b 100644
8efc740
--- a/backend/socket.c
8efc740
+++ b/backend/socket.c
8efc740
@@ -397,8 +397,10 @@ main(int  argc,				/* I - Number of command-line arguments (6 or 7) */
8efc740
       lseek(print_fd, 0, SEEK_SET);
8efc740
     }
8efc740
 
8efc740
-    tbytes = backendRunLoop(print_fd, device_fd, snmp_fd, &(addrlist->addr), 1,
8efc740
-                            0, backendNetworkSideCB);
8efc740
+    if ((bytes = backendRunLoop(print_fd, device_fd, snmp_fd, &(addrlist->addr), 1, 0, backendNetworkSideCB)) < 0)
8efc740
+      tbytes = -1;
8efc740
+    else
8efc740
+      tbytes = bytes;
8efc740
 
8efc740
     if (print_fd != 0 && tbytes >= 0)
8efc740
       _cupsLangPrintFilter(stderr, "INFO", _("Print file sent."));
8efc740
@@ -406,7 +408,7 @@ main(int  argc,				/* I - Number of command-line arguments (6 or 7) */
8efc740
 
8efc740
   fputs("STATE: +cups-waiting-for-job-completed\n", stderr);
8efc740
 
8efc740
-  if (waiteof)
8efc740
+  if (waiteof && tbytes >= 0)
8efc740
   {
8efc740
    /*
8efc740
     * Shutdown the socket and wait for the other end to finish...
8efc740
@@ -443,7 +445,7 @@ main(int  argc,				/* I - Number of command-line arguments (6 or 7) */
8efc740
   if (print_fd != 0)
8efc740
     close(print_fd);
8efc740
 
8efc740
-  return (CUPS_BACKEND_OK);
8efc740
+  return (tbytes >= 0 ? CUPS_BACKEND_OK : CUPS_BACKEND_FAILED);
8efc740
 }
8efc740
 
8efc740
 
8efc740
diff --git a/scheduler/main.c b/scheduler/main.c
8efc740
index 4b3914ade..472b9946d 100644
8efc740
--- a/scheduler/main.c
8efc740
+++ b/scheduler/main.c
8efc740
@@ -1472,9 +1472,16 @@ process_children(void)
8efc740
               (!job->filters[i] && WIFEXITED(old_status)))
8efc740
           {				/* Backend and filter didn't crash */
8efc740
 	    if (job->filters[i])
8efc740
+	    {
8efc740
 	      job->status = status;	/* Filter failed */
8efc740
+	    }
8efc740
 	    else
8efc740
+	    {
8efc740
 	      job->status = -status;	/* Backend failed */
8efc740
+
8efc740
+	      if (job->current_file < job->num_files)
8efc740
+	        cupsdSetJobState(job, IPP_JOB_ABORTED, CUPSD_JOB_FORCE, "Canceling multi-file job due to backend failure.");
8efc740
+	    }
8efc740
           }
8efc740
 
8efc740
 	  if (job->state_value == IPP_JOB_PROCESSING &&