In case of receiving a signal to terminate after init has been completed,
at_exit() is called and tries to write to a closed pipe.

This patch simply set pipe to -1 in order to invalidate it after closing.
Pipe value checks are allready present in the code.

Signed-off-by: Herve Codina <[email protected]>
---
 src/pcscdaemon.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/pcscdaemon.c b/src/pcscdaemon.c
index 27ee6c9..78b65b8 100644
--- a/src/pcscdaemon.c
+++ b/src/pcscdaemon.c
@@ -681,6 +681,7 @@ int main(int argc, char **argv)
                        Log2(PCSC_LOG_ERROR, "write() failed: %s", 
strerror(errno));
                }
                close(pipefd[1]);
+               pipefd[1] = -1;
        }
 
        SVCServiceRunLoop();
@@ -708,6 +709,7 @@ static void at_exit(void)
                        Log2(PCSC_LOG_ERROR, "write() failed: %s", 
strerror(errno));
                }
                close(pipefd[1]);
+               pipefd[1] = -1;
        }
 
        exit(ExitValue);
-- 
1.7.9.5


_______________________________________________
Pcsclite-muscle mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pcsclite-muscle

Reply via email to