diff options
author | jsorg71 <jsorg71> | 2009-05-29 02:03:10 +0000 |
---|---|---|
committer | jsorg71 <jsorg71> | 2009-05-29 02:03:10 +0000 |
commit | 48e06d526724c1257f024e5bd5026992f7654546 (patch) | |
tree | a01a66e48f1d1e497bb6efb66c0612190b4324bd /common | |
parent | e1461fd946cfb935aa5a6b148367775123d50b99 (diff) | |
download | xrdp-proprietary-48e06d526724c1257f024e5bd5026992f7654546.tar.gz xrdp-proprietary-48e06d526724c1257f024e5bd5026992f7654546.zip |
remove g_signal and change g_waitpid to check for signal
Diffstat (limited to 'common')
-rw-r--r-- | common/os_calls.c | 42 | ||||
-rw-r--r-- | common/os_calls.h | 2 |
2 files changed, 26 insertions, 18 deletions
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; } @@ -1714,17 +1714,6 @@ g_execlp3(const char* a1, const char* a2, const char* a3) /*****************************************************************************/ /* 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 g_signal_child_stop(void (*func)(int)) { #if defined(_WIN32) @@ -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)); |