summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2021-11-02 06:06:16 +0100
committerNIIBE Yutaka <gniibe@fsij.org>2021-11-02 06:06:16 +0100
commit49f7fcb90b5d4f33b9b65baec8774745aa2242c9 (patch)
treecf0cb77e091e029b531a9b53a48177e47a14b207
parentscd: Fix the previous commit. (diff)
downloadgnupg2-49f7fcb90b5d4f33b9b65baec8774745aa2242c9.tar.xz
gnupg2-49f7fcb90b5d4f33b9b65baec8774745aa2242c9.zip
scd: Simplify the loop of DEVINFO.
* scd/app.c (app_send_devinfo): Factor out lock/unlock. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
-rw-r--r--scd/app.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/scd/app.c b/scd/app.c
index 7a61fdc46..5fcf8fb87 100644
--- a/scd/app.c
+++ b/scd/app.c
@@ -424,16 +424,12 @@ app_send_devinfo (ctrl_t ctrl, int keep_looping)
app_t a;
int no_device;
+ card_list_w_lock ();
while (1)
{
- card_list_w_lock ();
-
no_device = (card_top == NULL);
if (no_device && keep_looping < 0)
- {
- card_list_w_unlock ();
- break;
- }
+ break;
send_status_direct (ctrl, "DEVINFO_START", "");
for (c = card_top; c; c = c->next)
@@ -452,13 +448,11 @@ app_send_devinfo (ctrl_t ctrl, int keep_looping)
send_status_direct (ctrl, "DEVINFO_END", "");
if (no_device && !keep_looping)
- {
- card_list_w_unlock ();
- break;
- }
+ break;
+
card_list_wait ();
- card_list_w_unlock ();
}
+ card_list_w_unlock ();
return no_device ? gpg_error (GPG_ERR_NOT_FOUND): 0;
}