aboutsummaryrefslogtreecommitdiffstats
path: root/src/spawn-posix.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2021-04-08core: Fix gpgrt_wait_processes, by skipping invalid PID.NIIBE Yutaka1-1/+6
* src/spawn-posix.c (_gpgrt_wait_processes): Skip invalid PID. -- The API itself is not good to handle multiple processes. Given the API, skipping invalid PID is better for usefulness. GnuPG-bug-id: 5381 Reported-by: Jakub Jelen <[email protected]> Signed-off-by: NIIBE Yutaka <[email protected]>
2019-06-18Portability fix for PID.NIIBE Yutaka1-1/+1
* src/spawn-posix.c (gpgrt_wait_processes): Cast to int. -- On some systems (like Solaris), pid_t is long int. Signed-off-by: NIIBE Yutaka <[email protected]>
2019-01-04core: New functions gpgrt_abort and gpgrt_add_emergency_cleanup.Werner Koch1-1/+0
* src/init.c (emergency_cleanup_list): New gloabl var. (_gpgrt_add_emergency_cleanup): New. (_gpgrt_abort): New. Repalce all calls to abort by this. Also replace all assert by either log_assert or a stderr output followed by a _gpgrt_abort. (run_emergency_cleanup): New. * src/visibility.c (gpgrt_add_emergency_cleanup): New public API. (gpgrt_abort): New public API. -- Libgcrypt uses its own assert function which makes sure to terminate the secure memory. This is safe as log as an assert is triggered internally in Libgcrypt. GnuPG runs emergency cleanup handlers right before log_fatal etc to tell Libgcrypt to terminate the secure memory. With the move of the logging function to gpgrt in gnupg 2.3 this did not anymore. Thus we now provide a mechanism in gpgrt to do right that. Eventually Libgcrypt can also make use of this. What this does not handle are calls to abort or failed asserts in external libraries or in libc. We can't do anything about it in a library because a library may not setup signal handlers. Signed-off-by: Werner Koch <[email protected]>
2017-11-29core: Wrap blocking system calls of the spawn functions.Werner Koch1-1/+20
Signed-off-by: Werner Koch <[email protected]>
2017-11-29core: Implement the spawn functions.Werner Koch1-206/+187
* src/gpg-error.h.in (GPGRT_SPAWN_NONBLOCK): New const. (GPGRT_SPAWN_RUN_ASFW): New const. (GPGRT_SPAWN_DETACHED): New const. (gpgrt_make_pipe): New function. (gpgrt_create_pipe): New macro. (gpgrt_create_inbound_pipe): New macro. (gpgrt_create_outbound_pipe): New macro. (gpgrt_spawn_process): New function. (gpgrt_spawn_process_fd): New function. (gpgrt_spawn_process_detached): New function. (gpgrt_wait_process): New function. (gpgrt_wait_processes): New function. (gpgrt_kill_process): New function. (gpgrt_release_process): New function. * src/gpg-error.def.in, src/gpg-error.vers: Add new functions. * src/visibility.c, src/visibility.h: Add wrappers for new functions. * src/spawn-posix.c: Rework to better fit the use in gpgrt. Rename all public function with a _gpgrt prefix. * src/spawn-w32.c: Ditto. * src/gpgrt-int.h: Likewise. * src/Makefile.am (arch_sources): Add spawn-posix.c and spawn-w32.c. * src/w32-add.h: Add pid_t typedef as a temporary hack. * configure.ac: Check for signal.h and getrlimit. (AC_FUNC_FORK): New. -- This does build but porting the tests and further changes are required. Don't assume that the API for the new fucntions is stable. Signed-off-by: Werner Koch <[email protected]>
2017-11-29Import and relicense exechelp* functions from GnuPG.Werner Koch1-0/+887
* src/spawn-posix.c: New. Taken from GnuPG's exechelp-posix.c. * src/spawn-w32.c: New. Taken from GnuPG's exechelp-w32.c. * src/gpgrt-int.h: Include prototypes from GnuPG's exechelp.h. -- The original files were under (LGPL-3.0+ OR GPL-2.0+) and have entirely been written by g10 Code employees. Being the responsible person at g10 Code, I endorse the license change to LGPL-2.1. Signed-off-by: Werner Koch <[email protected]>