diff options
author | Werner Koch <[email protected]> | 2009-10-13 19:17:24 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2009-10-13 19:17:24 +0000 |
commit | 536b6ab09fa3e17f955c8b55e8469f3265a1936f (patch) | |
tree | a06fba4fb448cc70de12a470d7dde7f22c3eaf8f /common/exechelp.c | |
parent | Replace C99 style vararg macro which was anyway not correct. (diff) | |
download | gnupg-536b6ab09fa3e17f955c8b55e8469f3265a1936f.tar.gz gnupg-536b6ab09fa3e17f955c8b55e8469f3265a1936f.zip |
Keep on hacking on g13. A simple --create and --mount does now work.
A hacked up encfs is required.
Diffstat (limited to 'common/exechelp.c')
-rw-r--r-- | common/exechelp.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/common/exechelp.c b/common/exechelp.c index 89604902a..4a385bcd7 100644 --- a/common/exechelp.c +++ b/common/exechelp.c @@ -1102,3 +1102,28 @@ gnupg_spawn_process_detached (const char *pgmname, const char *argv[], return 0; #endif /* !HAVE_W32_SYSTEM*/ } + + +/* Kill a process; that is send an appropriate signal to the process. + gnupg_wait_process must be called to actually remove the process + from the system. An invalid PID is ignored. */ +void +gnupg_kill_process (pid_t pid) +{ +#ifdef HAVE_W32_SYSTEM + /* Older versions of libassuan set PID to 0 on Windows to indicate + an invalid value. */ + if (pid != (pid_t) INVALID_HANDLE_VALUE && pid != 0) + { + HANDLE process = (HANDLE) pid; + + /* Arbitrary error code. */ + TerminateProcess (process, 1); + } +#else + if (pid != (pid_t)(-1)) + { + kill (pid, SIGTERM); + } +#endif +} |