From 3efe450ece2db30de202bd4d88f271ef93c50353 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Tue, 17 Mar 2020 14:23:10 +0900 Subject: [PATCH] watch: call notification to app_wait from scd_update_reader_status_file. Signed-off-by: NIIBE Yutaka --- scd/app.c | 11 +++++------ scd/scdaemon.c | 3 --- scd/scdaemon.h | 1 - 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/scd/app.c b/scd/app.c index da70f8705..aac9d304d 100644 --- a/scd/app.c +++ b/scd/app.c @@ -1937,6 +1937,7 @@ scd_update_reader_status_file (void) { card_t card, card_next; int periodical_check_needed = 0; + int reported = 0; npth_mutex_lock (&card_list_lock); for (card = card_top; card; card = card_next) @@ -1971,6 +1972,7 @@ scd_update_reader_status_file (void) { report_change (card->slot, card->card_status, status); send_client_notifications (card, status == 0); + reported++; if (status == 0) { @@ -1995,6 +1997,9 @@ scd_update_reader_status_file (void) } } + if (reported) + npth_cond_broadcast (¬ify_cond); + npth_mutex_unlock (&card_list_lock); return periodical_check_needed; @@ -2292,12 +2297,6 @@ app_do_with_keygrip (ctrl_t ctrl, int action, const char *keygrip_str, return c; } -void -app_notify (void) -{ - npth_cond_broadcast (¬ify_cond); -} - int app_wait (void) { diff --git a/scd/scdaemon.c b/scd/scdaemon.c index 1f34809bc..b7bbc0361 100644 --- a/scd/scdaemon.c +++ b/scd/scdaemon.c @@ -1220,9 +1220,6 @@ scd_kick_the_loop (void) log_error ("SetEvent for scd_kick_the_loop failed: %s\n", gpg_strerror (gpg_error_from_syserror ())); #endif - - /* Also, notify watching threads. */ - app_notify (); } /* Connection handler loop. Wait for connection requests and spawn a diff --git a/scd/scdaemon.h b/scd/scdaemon.h index c79c272a0..19f7e9d3f 100644 --- a/scd/scdaemon.h +++ b/scd/scdaemon.h @@ -154,6 +154,5 @@ int get_active_connection_count (void); /*-- app.c --*/ int scd_update_reader_status_file (void); int app_wait (void); -void app_notify (void); #endif /*SCDAEMON_H*/