X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/03647350fc7cd141953c72e0284e928847d30f44..a5655d37db9baabce654849fd66173f95f74e230:/src/unix/utilsunx.cpp diff --git a/src/unix/utilsunx.cpp b/src/unix/utilsunx.cpp index 18bea9bdef..6126c0a2e5 100644 --- a/src/unix/utilsunx.cpp +++ b/src/unix/utilsunx.cpp @@ -394,7 +394,7 @@ public: ArgsArray(wchar_t **wargv) { int argc = 0; - while ( *wargv++ ) + while ( wargv[argc] ) argc++; Init(argc); @@ -1373,15 +1373,21 @@ int DoWaitForChild(int pid, int flags = 0) { wxASSERT_MSG( rc == pid, "unexpected waitpid() return value" ); + // notice that the caller expects the exit code to be signed, e.g. -1 + // instead of 255 so don't assign WEXITSTATUS() to an int + signed char exitcode; if ( WIFEXITED(status) ) - return WEXITSTATUS(status); + exitcode = WEXITSTATUS(status); else if ( WIFSIGNALED(status) ) - return -WTERMSIG(status); + exitcode = -WTERMSIG(status); else { wxLogError("Child process (PID %d) exited for unknown reason, " "status = %d", pid, status); + exitcode = -1; } + + return exitcode; } return -1; @@ -1412,7 +1418,7 @@ int wxAppTraits::WaitForChild(wxExecuteData& execData) } //else: synchronous execution case -#if HAS_PIPE_INPUT_STREAM +#if HAS_PIPE_INPUT_STREAM && wxUSE_SOCKETS wxProcess * const process = execData.process; if ( process && process->IsRedirected() ) {