scd: Fix RESET command handling (more).
authorNIIBE Yutaka <gniibe@fsij.org>
Fri, 17 Feb 2017 02:50:40 +0000 (11:50 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Fri, 17 Feb 2017 02:50:40 +0000 (11:50 +0900)
commit99d4dfe83661d05ef3a20ed04e6cec5647536738
treebe9c8926be1a560ea3878ddf9b7e93eea44fc738
parent7006352da773d82c47797bbf11e570ecafac6501
scd: Fix RESET command handling (more).

* scd/app-common.h (struct app_ctx_s): Add reset_requested.
* scd/app.c (app_reset): Locking APP, set reset_requested.
(deallocate_app): Release the lock.
(release_application): Add LOCKED_ALREADY argument.
(scd_update_reader_status_file): Hold the lock when accessing APP.
When reset_requested is set, close the reader and deallocate APP.
* scd/command.c (open_card_with_request, cmd_restart): Follow the
change of release_application.
(send_client_notifications): Here it calls release_application holding
the lock.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
scd/app-common.h
scd/app.c
scd/command.c