mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
(destroy_dotlock): Remove the handle from the list of
locks. (release_dotlock): Don't act if we don't have any locks at all.
This commit is contained in:
parent
297459b28b
commit
5b82342c90
@ -1,3 +1,13 @@
|
||||
2004-08-23 Werner Koch <wk@g10code.de>
|
||||
|
||||
* dotlock.c (destroy_dotlock): Remove the handle from the list of
|
||||
locks.
|
||||
(release_dotlock): Don't act if we don't have any locks at all.
|
||||
|
||||
2004-08-19 Werner Koch <wk@g10code.de>
|
||||
|
||||
* dotlock.c (destroy_dotlock): Don't act on NULL filenames.
|
||||
|
||||
2004-08-19 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* http.c (insert_escapes): Fix encoding problem for non-URI-safe
|
||||
|
@ -204,15 +204,32 @@ destroy_dotlock ( DOTLOCK h )
|
||||
#if !defined (HAVE_DOSISH_SYSTEM)
|
||||
if ( h )
|
||||
{
|
||||
DOTLOCK hprev, htmp;
|
||||
|
||||
/* First remove the handle from our global list of all locks. */
|
||||
for (hprev=NULL, htmp=all_lockfiles; htmp; hprev=htmp, htmp=htmp->next)
|
||||
if (htmp == h)
|
||||
{
|
||||
if (hprev)
|
||||
hprev->next = htmp->next;
|
||||
else
|
||||
all_lockfiles = htmp->next;
|
||||
h->next = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Second destroy the lock. */
|
||||
if (!h->disable)
|
||||
{
|
||||
if (h->locked)
|
||||
if (h->locked && h->lockname)
|
||||
unlink (h->lockname);
|
||||
unlink (h->tname);
|
||||
if (h->tname)
|
||||
unlink (h->tname);
|
||||
m_free (h->tname);
|
||||
m_free (h->lockname);
|
||||
}
|
||||
m_free(h);
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -339,9 +356,15 @@ release_dotlock( DOTLOCK h )
|
||||
#else
|
||||
int pid;
|
||||
|
||||
if( h->disable ) {
|
||||
/* To avoid atexit race conditions we first check whether there
|
||||
are any locks left. It might happen that another atexit
|
||||
handler tries to release the lock while the atexit handler of
|
||||
this module already ran and thus H is undefined. */
|
||||
if(!all_lockfiles)
|
||||
return 0;
|
||||
|
||||
if( h->disable )
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( !h->locked ) {
|
||||
log_debug("oops, `%s' is not locked\n", h->lockname );
|
||||
|
Loading…
x
Reference in New Issue
Block a user