gpg: signal handling fix
authorNIIBE Yutaka <gniibe@fsij.org>
Fri, 12 Jul 2013 08:26:55 +0000 (17:26 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Fri, 12 Jul 2013 08:26:55 +0000 (17:26 +0900)
commit212a325d428e0ab5c51c42a3ea33efb21ad1f79f
tree1d3e785da838ac3d5feccbdd625bd8690f788784
parent6f0ec6ab485f48c8079ab2a16ed41ee7859f88ab
gpg: signal handling fix

* include/dotlock.h (dotlock_remove_lockfiles_reclaim): New.
  (dotlock_destroy, dotlock_remove_lockfiles): Add a flag to reclaim
  memory or not.
* util/dotlock.c (dotlock_create): Use
  dotlock_remove_lockfiles_reclaim for atexit.
  (dotlock_destroy_unix, dotlock_destroy)
  (dotlock_remove_lockfiles): Add a reclaim flag.
  (dotlock_remove_lockfiles_reclaim): New.
* g10/signal.c (got_fatal_signal): Disable flag of reclaim memory to
  avoid non-async-face call.
* g10/keydb.c (maybe_create_keyring): Follow the API change.
* g10/gpgv.c: Follow the API change.

--

signal handler got_fatal_signal should not call non-async-signal-safe
functions.  When malloc is interrupted by a signal, it screws up.

This issue is reported:
https://bugs.g10code.com/gnupg/issue1515
http://bugs.debian.org/399904
g10/gpgv.c
g10/keydb.c
g10/signal.c
include/dotlock.h
util/dotlock.c