From: gumartinm Date: Tue, 18 Dec 2012 05:30:04 +0000 (+0100) Subject: Right type for storing return code from fork X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=c83a1326cfc4f01b27049b60c63521716189a912;p=JavaTCPFork%2F.git Right type for storing return code from fork --- diff --git a/Daemon/javafork.c b/Daemon/javafork.c index fff50ec..86a1062 100644 --- a/Daemon/javafork.c +++ b/Daemon/javafork.c @@ -545,7 +545,7 @@ end: int fork_system(int socket, unsigned char *command, int *returnstatus) { - int pid; /*Child or parent PID.*/ + pid_t pid; /*Child or parent PID.*/ int out[2], err[2]; /*Store pipes file descriptors. Write ends attached to the stdout*/ /*and stderr streams.*/ u_char buf[2000]; /*Read data buffer. allignment(int) * 500.*/ @@ -599,7 +599,7 @@ int fork_system(int socket, unsigned char *command, int *returnstatus) exit(-1); } - /*Attach pipes to the stderr and stdout streams*/ + /*Attach stderr and stdout streams to my pipes (their write end)*/ if ((TEMP_FAILURE_RETRY(dup2(out[1], 1)) < 0) || (TEMP_FAILURE_RETRY(dup2(err[1], 2)) < 0)) { syslog (LOG_ERR, "child dup2 failed: %m"); /*Going to zombie state, hopefully waitpid will catch it*/