Open chscf opened 1 day ago
Hi,
Could you please provide more information on what operating system you are using, and possibly a reproducing program with debug logging enabled? I cannot reproduce this on any of my machines. My manual pages for flock(2)
state that (emphasis mine)
Locks created by flock() are associated with an open file description (see
open(2)
). This means that duplicate file descriptors (created by, for example,fork(2)
ordup(2)
) refer to the same lock, and this lock may be modified or released using any of these file descriptors. Furthermore, the lock is released either by an explicitLOCK_UN
operation on any of these duplicate file descriptors, or when all such file descriptors have been closed.
Which means that fido_dev_close()
should already release the lock.
Good day,
I'm using libfido2-1.14.0 on linux, and I ran into the following problem: after calling
and then calling
on the device I closed right before (i.e. with the same device path), fido_dev_open runs into a timeout. The reason is that the calls to flock
while (flock(ctx->fd, LOCK_EX|LOCK_NB) == -1) {
in fido_hid_open (hid_linux.c:259) never succeed.
Adding this
to fido_hid_close in hid_linux.c fixes this for me. Does this make any sense?
Thanks and best regards, Christian