diff options
author | NIIBE Yutaka <[email protected]> | 2023-12-20 01:38:08 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2023-12-20 02:05:22 +0000 |
commit | 2f6fec3f482d3a6660ce9bf299c0ff7fae21b80b (patch) | |
tree | 2381905502e2956cc1fb86f3d59bf76306a3beb8 | |
parent | common: Fix a possible resource leak for dotlock. (diff) | |
download | gnupg-2f6fec3f482d3a6660ce9bf299c0ff7fae21b80b.tar.gz gnupg-2f6fec3f482d3a6660ce9bf299c0ff7fae21b80b.zip |
common: Support not-removing the lockfile by dotlock_destroy.
* common/dotlock.c (dotlock_destroy): Keep the lock
when DOTLOCK_LOCK_BY_PARENT.
--
Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r-- | common/dotlock.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/common/dotlock.c b/common/dotlock.c index 06e3910ad..84d0b509c 100644 --- a/common/dotlock.c +++ b/common/dotlock.c @@ -1200,8 +1200,11 @@ dotlock_destroy (dotlock_t h) UNLOCK_all_lockfiles (); /* Then destroy the lock. */ - if (!h->disable) + if (!h->disable + && (!h->by_parent || h->no_write)) { + /* NOTE: under the condition of (by_parent && !no_write), + it doesn't come here. So, the lock file remains. */ #ifdef HAVE_DOSISH_SYSTEM dotlock_destroy_w32 (h); #else /* !HAVE_DOSISH_SYSTEM */ |