summary refs log tree commit diff
path: root/gnu/services
diff options
context:
space:
mode:
authorBrice Waegeneire <brice@waegenei.re>2021-06-12 16:46:00 +0200
committerBrice Waegeneire <brice@waegenei.re>2021-06-19 23:49:18 +0200
commit4bed8486d4c0a4ff142903b8bc1584ce84767355 (patch)
treed1d23833b73763be248455d62dd1b9621424f60f /gnu/services
parenteb939109b9c06a09e1534a403745bd362b653d95 (diff)
downloadguix-4bed8486d4c0a4ff142903b8bc1584ce84767355.tar.gz
services: pcscd: Cleanup socket when started.
Otherwise when pcscd doesn't terminate properly (ie. receive a SIGKILL),
it won't start again because of it's socket already existing.

* gnu/services/security-token.scm (pcscd-shepherd-service)[start]:
Remove existing socket file.
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/security-token.scm4
1 files changed, 4 insertions, 0 deletions
diff --git a/gnu/services/security-token.scm b/gnu/services/security-token.scm
index ec26006538..0cbb591e10 100644
--- a/gnu/services/security-token.scm
+++ b/gnu/services/security-token.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -57,6 +58,9 @@
         (requirement '(syslogd))
         (modules '((gnu build shepherd)))
         (start #~(lambda _
+                   (let ((socket "/run/pcscd/pcscd.comm"))
+                     (when (file-exists? socket)
+                       (delete-file socket)))
                    (invoke #$(file-append pcsc-lite "/sbin/pcscd"))
                    (call-with-input-file "/run/pcscd/pcscd.pid" read)))
         (stop #~(make-kill-destructor)))))))