diff mbox series

[bug#48987] services: pcscd: Cleanup socket when started.

Message ID 20210612212458.13456-1-brice@waegenei.re
State Accepted
Headers show
Series [bug#48987] services: pcscd: Cleanup socket when started. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Brice Waegeneire June 12, 2021, 9:24 p.m. UTC
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.
---
 gnu/services/security-token.scm | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Ludovic Courtès June 16, 2021, 8:54 p.m. UTC | #1
Hi,

Brice Waegeneire <brice@waegenei.re> skribis:

> 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.

LGTM, thanks!

Ludo’.
Brice Waegeneire June 19, 2021, 9:50 p.m. UTC | #2
Ludo',

Ludovic Courtès <ludo@gnu.org> writes:

> Brice Waegeneire <brice@waegenei.re> skribis:
>
>> * gnu/services/security-token.scm (pcscd-shepherd-service)[start]:
>> Remove existing socket file.
>
> LGTM, thanks!

Pushed as 4bed8486d4c0a4ff142903b8bc1584ce84767355.

Cheers,
- Brice
diff mbox series

Patch

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)))))))