mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
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
This commit is contained in:
parent
6f0ec6ab48
commit
212a325d42
5 changed files with 32 additions and 17 deletions
|
@ -434,7 +434,7 @@ void rl_free_line_state (void) {}
|
|||
void dotlock_disable(void) {}
|
||||
dotlock_t dotlock_create (const char *file_to_lock, unsigned int flags)
|
||||
{ return NULL; }
|
||||
void dotlock_destroy (dotlock_t h) {}
|
||||
void dotlock_destroy (dotlock_t h, int reclaim) {}
|
||||
int dotlock_take (dotlock_t h, long timeout) { return 0;}
|
||||
int dotlock_release (dotlock_t h) {return 0;}
|
||||
void dotlock_remove_lockfiles (void) {}
|
||||
void dotlock_remove_lockfiles (void, int reclaim) {}
|
||||
|
|
|
@ -181,7 +181,7 @@ maybe_create_keyring (char *filename, int force)
|
|||
if (lockhd)
|
||||
{
|
||||
dotlock_release (lockhd);
|
||||
dotlock_destroy (lockhd);
|
||||
dotlock_destroy (lockhd, 1);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ got_fatal_signal( int sig )
|
|||
|
||||
/* Reset action to default action and raise signal again. */
|
||||
init_one_signal (sig, SIG_DFL, 0);
|
||||
dotlock_remove_lockfiles ();
|
||||
dotlock_remove_lockfiles (0);
|
||||
#ifdef __riscos__
|
||||
riscos_close_fds ();
|
||||
#endif /* __riscos__ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue