Next: , Previous: , Up: Preparation   [Contents][Index]

2.7 Signal Handling

The GPGME library communicates with child processes (the crypto engines). If a child process dies unexpectedly, for example due to a bug, or system problem, a SIGPIPE signal will be delivered to the application. The default action is to abort the program. To protect against this, gpgme_check_version sets the SIGPIPE signal action to SIG_IGN, which means that the signal will be ignored.

GPGME will only do that if the signal action for SIGPIPE is SIG_DEF at the time gpgme_check_version is called. If it is something different, GPGME will take no action.

This means that if your application does not install any signal handler for SIGPIPE, you don’t need to take any precautions. If you do install a signal handler for SIGPIPE, you must be prepared to handle any SIGPIPE events that occur due to GPGME writing to a defunct pipe. Furthermore, if your application is multi-threaded, and you install a signal action for SIGPIPE, you must make sure you do this either before gpgme_check_version is called or afterwards.