diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/ChangeLog | 7 | ||||
-rw-r--r-- | util/dotlock.c | 33 |
2 files changed, 30 insertions, 10 deletions
diff --git a/util/ChangeLog b/util/ChangeLog index adfd49191..d151326d1 100644 --- a/util/ChangeLog +++ b/util/ChangeLog @@ -1,3 +1,8 @@ +2004-08-11 Werner Koch <[email protected]> + + * dotlock.c (destroy_dotlock): New. + (remove_lockfiles): Implement in terms of destroy_dotlock. + 2004-08-09 Werner Koch <[email protected]> * Makefile.am (http-test): Replaced INTLLIBS by LIBINTL. @@ -1105,7 +1110,7 @@ Fri Feb 13 15:14:13 1998 Werner Koch ([email protected]) - Copyright 1998,1999,2000,2001,2002,2003 Free Software Foundation, Inc. + Copyright 1998,1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. This file is free software; as a special exception the author gives unlimited permission to copy and/or distribute it, with or without diff --git a/util/dotlock.c b/util/dotlock.c index f4ab37327..f28b0e409 100644 --- a/util/dotlock.c +++ b/util/dotlock.c @@ -1,5 +1,5 @@ /* 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. * @@ -197,6 +197,28 @@ create_dotlock( const char *file_to_lock ) return h; } + +void +destroy_dotlock ( DOTLOCK h ) +{ +#if !defined (HAVE_DOSISH_SYSTEM) + if ( h ) + { + if (!h->disable) + { + if (h->locked) + unlink (h->lockname); + unlink (h->tname); + m_free (h->tname); + m_free (h->lockname); + } + m_free(h); + } +#endif +} + + + static int maybe_deadlock( DOTLOCK h ) { @@ -407,14 +429,7 @@ remove_lockfiles() while( h ) { h2 = h->next; - if( !h->disable ) { - if( h->locked ) - unlink( h->lockname ); - unlink(h->tname); - m_free(h->tname); - m_free(h->lockname); - } - m_free(h); + destroy_dotlock (h); h = h2; } #endif |