[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cups-commit
Subject:    [cups.commit] [CUPS] r10421 - trunk/scheduler
From:       cups-dev () easysw ! com
Date:       2012-04-20 3:11:55
Message-ID: 11193-cups.commit () news ! easysw ! com
[Download RAW message or body]

Author: mike
Date: 2012-04-19 20:11:55 -0700 (Thu, 19 Apr 2012)
New Revision: 10421
Log:
Preserve the most serious exit status for logging.


Modified:
   trunk/scheduler/main.c

Modified: trunk/scheduler/main.c
===================================================================
--- trunk/scheduler/main.c	2012-04-20 03:01:06 UTC (rev 10420)
+++ trunk/scheduler/main.c	2012-04-20 03:11:55 UTC (rev 10421)
@@ -1604,7 +1604,7 @@
 	}
 
 	if (status && status != SIGTERM && status != SIGKILL &&
-	    status != SIGPIPE && job->status >= 0)
+	    status != SIGPIPE)
 	{
 	 /*
 	  * An error occurred; save the exit status so we know to stop
@@ -1612,13 +1612,25 @@
 	  *
 	  * A negative status indicates that the backend failed and the
 	  * printer needs to be stopped.
+	  *
+	  * In order to preserve the most serious status, we always log
+	  * when a process dies due to a signal (e.g. SIGABRT, SIGSEGV,
+	  * and SIGBUS) and prefer to log the backend exit status over a
+	  * filter's.
 	  */
 
-	  if (job->filters[i])
-	    job->status = status;	/* Filter failed */
-	  else
-	    job->status = -status;	/* Backend failed */
+	  int old_status = abs(job->status);
 
+          if (WIFSIGNALED(status) ||	/* This process crashed, or */
+              !job->status ||		/* No process had a status, or */
+              (!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->state_value == IPP_JOB_PROCESSING &&
 	      job->status_level > CUPSD_LOG_ERROR &&
 	      (job->filters[i] || !WIFEXITED(status)))

_______________________________________________
cups-commit mailing list
cups-commit@easysw.com
http://lists.easysw.com/mailman/listinfo/cups-commit
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic