diff --git a/common/os_calls.c b/common/os_calls.c index ba9ec4b8..e805a09f 100644 --- a/common/os_calls.c +++ b/common/os_calls.c @@ -914,7 +914,7 @@ g_obj_wait(tbus* read_objs, int rcount, tbus* write_objs, int wcount, if ((errno == EAGAIN) || (errno == EWOULDBLOCK) || (errno == EINPROGRESS) || - (errno == EINTR)) /* signal occured */ + (errno == EINTR)) /* signal occurred */ { return 0; } @@ -1711,17 +1711,6 @@ g_execlp3(const char* a1, const char* a2, const char* a3) #endif } -/*****************************************************************************/ -/* does not work in win32 */ -void APP_CC -g_signal(int sig_num, void (*func)(int)) -{ -#if defined(_WIN32) -#else - signal(sig_num, func); -#endif -} - /*****************************************************************************/ /* does not work in win32 */ void APP_CC @@ -1852,7 +1841,8 @@ g_setuid(int pid) } /*****************************************************************************/ -/* does not work in win32 */ +/* does not work in win32 + returns pid of process that exits or zero if signal occurred */ int APP_CC g_waitchild(void) { @@ -1860,20 +1850,40 @@ g_waitchild(void) return 0; #else int wstat; + int rv; - return waitpid(0, &wstat, WNOHANG); + rv = waitpid(0, &wstat, WNOHANG); + if (rv == -1) + { + if (errno == EINTR) /* signal occurred */ + { + rv = 0; + } + } + return rv; #endif } /*****************************************************************************/ -/* does not work in win32 */ +/* does not work in win32 + returns pid of process that exits or zero if signal occurred */ int APP_CC g_waitpid(int pid) { #if defined(_WIN32) return 0; #else - return waitpid(pid, 0, 0); + int rv; + + rv = waitpid(pid, 0, 0); + if (rv == -1) + { + if (errno == EINTR) /* signal occurred */ + { + rv = 0; + } + } + return rv; #endif } diff --git a/common/os_calls.h b/common/os_calls.h index 5f84694d..bc4f26f8 100644 --- a/common/os_calls.h +++ b/common/os_calls.h @@ -195,8 +195,6 @@ g_execvp(const char* p1, char* args[]); int APP_CC g_execlp3(const char* a1, const char* a2, const char* a3); void APP_CC -g_signal(int sig_num, void (*func)(int)); -void APP_CC g_signal_child_stop(void (*func)(int)); void APP_CC g_signal_hang_up(void (*func)(int));