trylock_stream has a bug, it seems that it never works correctly.
Description
Description
| Status | Assigned | Task | ||
|---|---|---|---|---|
| Open | None | T8518 gpg: Hang on exit after trustdb error, when keyboxd is in use | ||
| Open | None | T8519 trylock_stream bug (exposed as gpgrt_ftrylockfile) |
Event Timeline
Comment Actions
Internally, _gpgrt_lock_trylock returns an error code on error, 0 when success.
It seems that trylock_stream (and thus gpgrt_ftrylockfile) should return -1 on error, 0 when success.
Here is a patch:
diff --git a/src/estream.c b/src/estream.c index ba345ff..301a078 100644 --- a/src/estream.c +++ b/src/estream.c @@ -476,7 +476,7 @@ trylock_stream (estream_t _GPGRT__RESTRICT stream) if (!stream->intern->samethread) { dbg_lock_1 ("enter trylock_stream for %p\n", stream); - rc = _gpgrt_lock_trylock (&stream->intern->lock)? 0 : -1; + rc = _gpgrt_lock_trylock (&stream->intern->lock)? -1 : 0; dbg_lock_2 ("leave trylock_stream for %p: rc=%d\n", stream, rc); } else