diff options
author | NIIBE Yutaka <[email protected]> | 2023-12-20 01:53:50 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2023-12-20 02:05:36 +0000 |
commit | b298322d36d4fc9a8d86515410e1d3f2cddea19f (patch) | |
tree | 88a42045226875d0682b828bac7f946f5660c105 /common/dotlock.c | |
parent | common: Support not-removing the lockfile by dotlock_destroy. (diff) | |
download | gnupg-b298322d36d4fc9a8d86515410e1d3f2cddea19f.tar.gz gnupg-b298322d36d4fc9a8d86515410e1d3f2cddea19f.zip |
common: Clean up the temporary file at dotlock_destroy.
* common/dotlock.c (dotlock_destroy): Clean up the temporary file
created when it fails.
--
Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'common/dotlock.c')
-rw-r--r-- | common/dotlock.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/common/dotlock.c b/common/dotlock.c index 84d0b509c..fe6d7fe71 100644 --- a/common/dotlock.c +++ b/common/dotlock.c @@ -1213,6 +1213,12 @@ dotlock_destroy (dotlock_t h) } #ifdef HAVE_POSIX_SYSTEM + /* When DOTLOCK_LOCK_BY_PARENT and lock fails, + the temporary file created should be removed. */ + if (h->by_parent && !h->no_write && !h->locked) + if (h->tname && !h->use_o_excl) + unlink (h->tname); + xfree (h->tname); #endif xfree (h->lockname); |