diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2021-11-02 06:06:16 +0100 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2021-11-02 06:06:16 +0100 |
commit | 49f7fcb90b5d4f33b9b65baec8774745aa2242c9 (patch) | |
tree | cf0cb77e091e029b531a9b53a48177e47a14b207 | |
parent | scd: Fix the previous commit. (diff) | |
download | gnupg2-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.c | 16 |
1 files changed, 5 insertions, 11 deletions
@@ -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; } |