diff options
Diffstat (limited to 'gpgme/posix-io.c')
-rw-r--r-- | gpgme/posix-io.c | 55 |
1 files changed, 24 insertions, 31 deletions
diff --git a/gpgme/posix-io.c b/gpgme/posix-io.c index d4289846..3479483e 100644 --- a/gpgme/posix-io.c +++ b/gpgme/posix-io.c @@ -174,6 +174,30 @@ _gpgme_io_set_nonblocking (int fd) } +static int +_gpgme_io_waitpid (int pid, int hang, int *r_status, int *r_signal) +{ + int status; + + *r_status = 0; + *r_signal = 0; + if (_gpgme_ath_waitpid (pid, &status, hang? 0 : WNOHANG) == pid) + { + if (WIFSIGNALED (status)) + { + *r_status = 4; /* Need some value here. */ + *r_signal = WTERMSIG (status); + } + else if (WIFEXITED (status)) + *r_status = WEXITSTATUS (status); + else + *r_status = 4; /* Oops. */ + return 1; + } + return 0; +} + + /* Returns 0 on success, -1 on error. */ int _gpgme_io_spawn (const char *path, char **argv, @@ -273,37 +297,6 @@ _gpgme_io_spawn (const char *path, char **argv, } -int -_gpgme_io_waitpid (int pid, int hang, int *r_status, int *r_signal) -{ - int status; - - *r_status = 0; - *r_signal = 0; - if (_gpgme_ath_waitpid (pid, &status, hang? 0 : WNOHANG) == pid) - { - if (WIFSIGNALED (status)) - { - *r_status = 4; /* Need some value here. */ - *r_signal = WTERMSIG (status); - } - else if (WIFEXITED (status)) - *r_status = WEXITSTATUS (status); - else - *r_status = 4; /* Oops. */ - return 1; - } - return 0; -} - - -int -_gpgme_io_kill (int pid, int hard) -{ - return kill (pid, hard ? SIGKILL : SIGTERM); -} - - /* * Select on the list of fds. * Returns: -1 = error |