Home GnuPG
Diffusion GnuPG d94b411f129f

common: Fix a race condition removing stale lockfile.
Concern Raisedd94b411f129f

Description

common: Fix a race condition removing stale lockfile.

* common/dotlock.c (read_lockfile): Return the file descriptor when
R_FD is available.
(dotlock_take_unix): Check the case the lockfile was already removed.
  • GnuPG-bug-id: T5884
  • Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>

Details

Event Timeline

werner added a subscriber: werner.
werner added inline comments.
/common/dotlock.c
1134

What about systems w/o hardlink support (h->use_o_excl)? I recall that I wrote changed the code once to support such systems (actually for a large installation of gnupg)

This commit now has outstanding concerns.Mar 18 2022, 8:49 AM

For the logic of detecting unlocking, it should work when h->use_o_excl == 1.

When h->use_o_excl == 0, the removed comment is irrelevant, because it fails at the creation of lockfile.

The comment removed matters when h->use_o_excl == 1. I overlooked this case.
I'll add comment back.