mirror of
git://git.gnupg.org/gnupg.git
synced 2024-11-10 21:38:50 +01:00
* iobuf.c (pop_filter): Make static.
* dotlock.c (destroy_dotlock): New. Remove the handle from the list of locks. (release_dotlock): Don't act if we don't have any locks at all. From Werner on stable branch.
This commit is contained in:
parent
ec0cc1f135
commit
d0a1816d7f
@ -1,3 +1,12 @@
|
|||||||
|
2004-09-30 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* iobuf.c (pop_filter): Make static.
|
||||||
|
|
||||||
|
* dotlock.c (destroy_dotlock): New. Remove the handle from the
|
||||||
|
list of locks.
|
||||||
|
(release_dotlock): Don't act if we don't have any locks at all.
|
||||||
|
From Werner on stable branch.
|
||||||
|
|
||||||
2004-09-10 David Shaw <dshaw@jabberwocky.com>
|
2004-09-10 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
* http.c (make_radix64_string, do_parse_uri, send_request): Add
|
* http.c (make_radix64_string, do_parse_uri, send_request): Add
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* dotlock.c - dotfile locking
|
/* dotlock.c - dotfile locking
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
* Copyright (C) 1998, 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -197,6 +197,45 @@ create_dotlock( const char *file_to_lock )
|
|||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
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 && h->lockname)
|
||||||
|
unlink (h->lockname);
|
||||||
|
if (h->tname)
|
||||||
|
unlink (h->tname);
|
||||||
|
m_free (h->tname);
|
||||||
|
m_free (h->lockname);
|
||||||
|
}
|
||||||
|
m_free(h);
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
maybe_deadlock( DOTLOCK h )
|
maybe_deadlock( DOTLOCK h )
|
||||||
{
|
{
|
||||||
@ -317,9 +356,15 @@ release_dotlock( DOTLOCK h )
|
|||||||
#else
|
#else
|
||||||
int pid;
|
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;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
if( !h->locked ) {
|
if( !h->locked ) {
|
||||||
log_debug("oops, `%s' is not locked\n", h->lockname );
|
log_debug("oops, `%s' is not locked\n", h->lockname );
|
||||||
@ -407,14 +452,7 @@ remove_lockfiles()
|
|||||||
|
|
||||||
while( h ) {
|
while( h ) {
|
||||||
h2 = h->next;
|
h2 = h->next;
|
||||||
if( !h->disable ) {
|
destroy_dotlock (h);
|
||||||
if( h->locked )
|
|
||||||
unlink( h->lockname );
|
|
||||||
unlink(h->tname);
|
|
||||||
m_free(h->tname);
|
|
||||||
m_free(h->lockname);
|
|
||||||
}
|
|
||||||
m_free(h);
|
|
||||||
h = h2;
|
h = h2;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1354,7 +1354,7 @@ iobuf_push_filter2( IOBUF a,
|
|||||||
/****************
|
/****************
|
||||||
* Remove an i/o filter.
|
* Remove an i/o filter.
|
||||||
*/
|
*/
|
||||||
int
|
static int
|
||||||
pop_filter( IOBUF a, int (*f)(void *opaque, int control,
|
pop_filter( IOBUF a, int (*f)(void *opaque, int control,
|
||||||
IOBUF chain, byte *buf, size_t *len), void *ov )
|
IOBUF chain, byte *buf, size_t *len), void *ov )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user