mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-06 12:33:23 +01:00
Fix killing PID -1.
When the KILLSCD command had been sent a race condition would occur causing PID -1 getting killed, which on Linux seems to terminate all applications for the current user.
This commit is contained in:
parent
f1e1387bee
commit
bee0ac28c9
@ -1016,6 +1016,7 @@ pcsc_get_status_wrapped (int slot, unsigned int *status)
|
|||||||
close (slotp->pcsc.rsp_fd);
|
close (slotp->pcsc.rsp_fd);
|
||||||
slotp->pcsc.req_fd = -1;
|
slotp->pcsc.req_fd = -1;
|
||||||
slotp->pcsc.rsp_fd = -1;
|
slotp->pcsc.rsp_fd = -1;
|
||||||
|
if (slotp->pcsc.pid != -1)
|
||||||
kill (slotp->pcsc.pid, SIGTERM);
|
kill (slotp->pcsc.pid, SIGTERM);
|
||||||
slotp->pcsc.pid = (pid_t)(-1);
|
slotp->pcsc.pid = (pid_t)(-1);
|
||||||
slotp->used = 0;
|
slotp->used = 0;
|
||||||
@ -1180,6 +1181,7 @@ pcsc_send_apdu_wrapped (int slot, unsigned char *apdu, size_t apdulen,
|
|||||||
close (slotp->pcsc.rsp_fd);
|
close (slotp->pcsc.rsp_fd);
|
||||||
slotp->pcsc.req_fd = -1;
|
slotp->pcsc.req_fd = -1;
|
||||||
slotp->pcsc.rsp_fd = -1;
|
slotp->pcsc.rsp_fd = -1;
|
||||||
|
if (slotp->pcsc.pid != -1)
|
||||||
kill (slotp->pcsc.pid, SIGTERM);
|
kill (slotp->pcsc.pid, SIGTERM);
|
||||||
slotp->pcsc.pid = (pid_t)(-1);
|
slotp->pcsc.pid = (pid_t)(-1);
|
||||||
slotp->used = 0;
|
slotp->used = 0;
|
||||||
@ -1321,6 +1323,7 @@ control_pcsc_wrapped (int slot, unsigned long ioctl_code,
|
|||||||
close (slotp->pcsc.rsp_fd);
|
close (slotp->pcsc.rsp_fd);
|
||||||
slotp->pcsc.req_fd = -1;
|
slotp->pcsc.req_fd = -1;
|
||||||
slotp->pcsc.rsp_fd = -1;
|
slotp->pcsc.rsp_fd = -1;
|
||||||
|
if (slotp->pcsc.pid != -1)
|
||||||
kill (slotp->pcsc.pid, SIGTERM);
|
kill (slotp->pcsc.pid, SIGTERM);
|
||||||
slotp->pcsc.pid = (pid_t)(-1);
|
slotp->pcsc.pid = (pid_t)(-1);
|
||||||
slotp->used = 0;
|
slotp->used = 0;
|
||||||
@ -1422,6 +1425,7 @@ close_pcsc_reader_wrapped (int slot)
|
|||||||
close (slotp->pcsc.rsp_fd);
|
close (slotp->pcsc.rsp_fd);
|
||||||
slotp->pcsc.req_fd = -1;
|
slotp->pcsc.req_fd = -1;
|
||||||
slotp->pcsc.rsp_fd = -1;
|
slotp->pcsc.rsp_fd = -1;
|
||||||
|
if (slotp->pcsc.pid != -1)
|
||||||
kill (slotp->pcsc.pid, SIGTERM);
|
kill (slotp->pcsc.pid, SIGTERM);
|
||||||
slotp->pcsc.pid = (pid_t)(-1);
|
slotp->pcsc.pid = (pid_t)(-1);
|
||||||
slotp->used = 0;
|
slotp->used = 0;
|
||||||
@ -1640,6 +1644,7 @@ reset_pcsc_reader_wrapped (int slot)
|
|||||||
close (slotp->pcsc.rsp_fd);
|
close (slotp->pcsc.rsp_fd);
|
||||||
slotp->pcsc.req_fd = -1;
|
slotp->pcsc.req_fd = -1;
|
||||||
slotp->pcsc.rsp_fd = -1;
|
slotp->pcsc.rsp_fd = -1;
|
||||||
|
if (slotp->pcsc.pid != -1)
|
||||||
kill (slotp->pcsc.pid, SIGTERM);
|
kill (slotp->pcsc.pid, SIGTERM);
|
||||||
slotp->pcsc.pid = (pid_t)(-1);
|
slotp->pcsc.pid = (pid_t)(-1);
|
||||||
slotp->used = 0;
|
slotp->used = 0;
|
||||||
@ -1965,6 +1970,7 @@ open_pcsc_reader_wrapped (const char *portstr)
|
|||||||
close (slotp->pcsc.rsp_fd);
|
close (slotp->pcsc.rsp_fd);
|
||||||
slotp->pcsc.req_fd = -1;
|
slotp->pcsc.req_fd = -1;
|
||||||
slotp->pcsc.rsp_fd = -1;
|
slotp->pcsc.rsp_fd = -1;
|
||||||
|
if (slotp->pcsc.pid != -1)
|
||||||
kill (slotp->pcsc.pid, SIGTERM);
|
kill (slotp->pcsc.pid, SIGTERM);
|
||||||
slotp->pcsc.pid = (pid_t)(-1);
|
slotp->pcsc.pid = (pid_t)(-1);
|
||||||
slotp->used = 0;
|
slotp->used = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user