Debug info and minor fix on child process exit (service exit)

* Added debug information when child process exits
	- pid of child process (service)
	- exit code (this should help for debuging issues related to "Session closed")

* Fixed status checking from waitpid() when child process exits
	- before we were checking wrong variable (checks were allways true)
	- now we use correct status variable
This commit is contained in:
KLuka 2015-01-13 13:04:01 +01:00
parent 7e0374b783
commit bd3f0bd9fd

View file

@ -1616,7 +1616,8 @@ static void launcherDaemon(int fd) {
int status;
pid_t pid;
while (NOINTR(pid = waitpid(-1, &status, WNOHANG)) > 0) {
if (WIFEXITED(pid) || WIFSIGNALED(pid)) {
debug("Child %d exited with exit code %d\n", pid, WEXITSTATUS(status));
if (WIFEXITED(status) || WIFSIGNALED(status)) {
char key[32];
snprintf(&key[0], sizeof(key), "%d", pid);
deleteFromHashMap(childProcesses, key);
@ -1636,7 +1637,8 @@ static void launcherDaemon(int fd) {
break;
}
while (NOINTR(pid = waitpid(-1, &status, WNOHANG)) > 0) {
if (WIFEXITED(pid) || WIFSIGNALED(pid)) {
debug("Child %d exited with exit code %d\n", pid, WEXITSTATUS(status));
if (WIFEXITED(status) || WIFSIGNALED(status)) {
char key[32];
snprintf(&key[0], sizeof(key), "%d", pid);
deleteFromHashMap(childProcesses, key);