From f74d304fedd0d10a69b6b82e69d8deb5bec76d8a Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 5 Dec 2018 12:51:18 +0100 Subject: cleanup --- guix/shepherd-with-sock.scm | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'guix') diff --git a/guix/shepherd-with-sock.scm b/guix/shepherd-with-sock.scm index 8942181..a201c71 100644 --- a/guix/shepherd-with-sock.scm +++ b/guix/shepherd-with-sock.scm @@ -14,6 +14,16 @@ (define %pid-file-timeout (@@ (shepherd service) %pid-file-timeout)) +(define (clean-up-file file) + (when file + (catch 'system-error + (lambda () + (delete-file file)) + (lambda args + (unless (= ENOENT (system-error-errno args)) + (apply throw args)))))) + + (define (open-service-stdin stdin-socket) (define (get-sock pf af . addr) (let ((sock (socket pf SOCK_STREAM 0))) @@ -21,6 +31,7 @@ (fileno sock))) (match stdin-socket (('unix sockpath) + (clean-up-file sockpath) (get-sock PF_UNIX AF_UNIX sockpath)) (('tcp addr port) (get-sock PF_INET AF_INET (inet-pton AF_INET addr) port)) @@ -163,15 +174,6 @@ its PID." pid))) -(define (clean-up file) - (when file - (catch 'system-error - (lambda () - (delete-file file)) - (lambda args - (unless (= ENOENT (system-error-errno args)) - (apply throw args)))))) - (define make-forkexec-constructor (let ((warn-deprecated-form -- cgit v1.2.3