[prev in list] [next in list] [prev in thread] [next in thread]
List: cups-commit
Subject: [cups.commit] [CUPS] r9783 - trunk/scheduler
From: cups-dev () easysw ! com
Date: 2011-05-18 20:44:28
Message-ID: 10554-cups.commit () news ! easysw ! com
[Download RAW message or body]
Author: mike
Date: 2011-05-18 13:44:16 -0700 (Wed, 18 May 2011)
New Revision: 9783
Log:
Don't use fprintf from child process since that call is not async-signal-safe.
Instead, log errno errors when we get the child process exit status.
Modified:
trunk/scheduler/main.c
trunk/scheduler/process.c
Modified: trunk/scheduler/main.c
===================================================================
--- trunk/scheduler/main.c 2011-05-18 18:56:57 UTC (rev 9782)
+++ trunk/scheduler/main.c 2011-05-18 20:44:16 UTC (rev 9783)
@@ -1727,10 +1727,20 @@
else if (status)
{
if (WIFEXITED(status))
- cupsdLogMessage(CUPSD_LOG_DEBUG, "PID %d (%s) stopped with status %d!",
- pid, name, WEXITSTATUS(status));
+ {
+ int code = WEXITSTATUS(status); /* Exit code */
+
+ if (code > 100)
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
+ "PID %d (%s) stopped with status %d (%s)", pid, name,
+ code, strerror(code - 100));
+ else
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
+ "PID %d (%s) stopped with status %d.", pid, name,
+ code);
+ }
else
- cupsdLogMessage(CUPSD_LOG_ERROR, "PID %d (%s) crashed on signal %d!",
+ cupsdLogMessage(CUPSD_LOG_ERROR, "PID %d (%s) crashed on signal %d.",
pid, name, WTERMSIG(status));
if (LogLevel < CUPSD_LOG_DEBUG)
Modified: trunk/scheduler/process.c
===================================================================
--- trunk/scheduler/process.c 2011-05-18 18:56:57 UTC (rev 9782)
+++ trunk/scheduler/process.c 2011-05-18 20:44:16 UTC (rev 9783)
@@ -446,16 +446,10 @@
#ifdef HAVE_SETPGID
if (!RunUser && setpgid(0, 0))
- {
- fprintf(stderr, "ERROR: %s (setpgid): %s\n", command, strerror(errno));
- exit(1);
- }
+ exit(errno + 100);
#else
if (!RunUser && setpgrp())
- {
- fprintf(stderr, "ERROR: %s (setpgrp): %s\n", command, strerror(errno));
- exit(1);
- }
+ exit(errno + 100);
#endif /* HAVE_SETPGID */
/*
@@ -519,20 +513,13 @@
*/
if (setgid(Group))
- {
- fprintf(stderr, "ERROR: %s (setgid): %s\n", command, strerror(errno));
- exit(1);
- }
+ exit(errno + 100);
if (setgroups(1, &Group))
- {
- fprintf(stderr, "ERROR: %s (setgroups): %s\n", command,
- strerror(errno));
- exit(1);
- }
+ exit(errno + 100);
if (setuid(User))
- exit(1);
+ exit(errno + 100);
}
else
{
@@ -541,17 +528,10 @@
*/
if (setgid(Group) && !RunUser)
- {
- fprintf(stderr, "ERROR: %s (setgid): %s\n", command, strerror(errno));
- exit(1);
- }
+ exit(errno + 100);
if (setgroups(1, &Group) && !RunUser)
- {
- fprintf(stderr, "ERROR: %s (setgroups): %s\n", command,
- strerror(errno));
- exit(1);
- }
+ exit(errno + 100);
}
/*
@@ -595,8 +575,7 @@
else
execv(exec_path, argv);
- fprintf(stderr, "ERROR: %s (execv): %s\n", command, strerror(errno));
- exit(1);
+ exit(errno + 100);
}
else if (*pid < 0)
{
_______________________________________________
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