aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2024-09-18 04:44:53 +0000
committerWerner Koch <[email protected]>2024-09-19 11:24:22 +0000
commit32476f870d629dd4408e7a7fea6e0c867b8fd84a (patch)
treecd2de858b19fb2515500cf0b7a594185ebcbf767
parentbuild: Fix make distclean for gnupg.7.html (diff)
downloadgnupg-32476f870d629dd4408e7a7fea6e0c867b8fd84a.tar.gz
gnupg-32476f870d629dd4408e7a7fea6e0c867b8fd84a.zip
scd: Fix DEVINFO to allow multiple clients.
* scd/app.c (initialize_module_command): Use O_NONBLOCK for pipe. -- GnuPG-bug-id: 7151 Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r--scd/app.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/scd/app.c b/scd/app.c
index e78268b50..3e300fbaa 100644
--- a/scd/app.c
+++ b/scd/app.c
@@ -24,6 +24,10 @@
#include <string.h>
#include <npth.h>
+#ifndef HAVE_W32_SYSTEM
+#include <fcntl.h> /* F_SETFD F_GETFL F_SETFL O_NONBLOCK fcntl(2) */
+#endif
+
#include "scdaemon.h"
#include "../common/exechelp.h"
#include "iso7816.h"
@@ -2639,6 +2643,11 @@ initialize_module_command (void)
log_error ("pipe creation failed: %s\n", gpg_strerror (ret));
return err;
}
+ /* There may be multiple clients for DEVINFO --watch.
+ * O_NONBLOCK allows multiple accesses, not blocking at read(2). */
+ if (fcntl (card_list_lock.notify_pipe[0], F_SETFL, O_NONBLOCK) < 0)
+ log_error ("fcntl failed: %s\n",
+ gpg_strerror (gpg_error_from_syserror ()));
#endif
return apdu_init ();