unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Diego Nicola Barbato <dnbarbato@posteo.de>
To: 40937@debbugs.gnu.org
Subject: [bug#40937] [PATCH] services: syslog: Simplify 'start' method.
Date: Tue, 28 Apr 2020 15:22:58 +0200	[thread overview]
Message-ID: <87tv13hhhp.fsf@GlaDOS.home> (raw)

[-- Attachment #1: Type: text/plain, Size: 297 bytes --]

Hey Guix,

This patch simplifies the 'start' method of 'syslog-service-type' by
setting the umask using the new #:file-creation-mask parameter of
'make-forkexec-constructor', which was introduced in version 0.8.0 of
the Shepherd, instead of wrapping the constructor in a lambda.

Regards,

Diego


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-services-syslog-Simplify-start-method.patch --]
[-- Type: text/x-patch, Size: 2038 bytes --]

From 5ac4af21427afb8ef498b0de7151f116a6f7d9eb Mon Sep 17 00:00:00 2001
From: Diego Nicola Barbato <dnbarbato@posteo.de>
Date: Tue, 28 Apr 2020 13:31:54 +0200
Subject: [PATCH] services: syslog: Simplify 'start' method.

This is a followup to d7113bb655ff80a868a9e624c913f9d23e6c63ad and
e3358a831e7d5d9e8dc614340e49ea5aeb11a7ff.

* gnu/services/base.scm (syslog-service-type): Change 'start' method to set
  umask using the #:file-creation-mask parameter of
  'make-forkexec-constructor' introduced in version 0.8.0 of the Shepherd.
---
 gnu/services/base.scm | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 2913478e4a..0f119cc2f9 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -1316,17 +1316,13 @@ Service Switch}, for an example."
       (documentation "Run the syslog daemon (syslogd).")
       (provision '(syslogd))
       (requirement '(user-processes))
-      (start #~(let ((spawn (make-forkexec-constructor
-                             (list #$(syslog-configuration-syslogd config)
-                                   "--rcfile"
-                                   #$(syslog-configuration-config-file config))
-                             #:pid-file "/var/run/syslog.pid")))
-                 (lambda ()
-                   ;; Set the umask such that file permissions are #o640.
-                   (let ((mask (umask #o137))
-                         (pid  (spawn)))
-                     (umask mask)
-                     pid))))
+      (start #~(make-forkexec-constructor
+                (list #$(syslog-configuration-syslogd config)
+                      "--rcfile"
+                      #$(syslog-configuration-config-file config))
+                ;; Set the umask such that file permissions are #o640.
+                #:file-creation-mask #o137
+                #:pid-file "/var/run/syslog.pid"))
       (stop #~(make-kill-destructor))))))
 
 ;; Snippet adapted from the GNU inetutils manual.
-- 
2.26.0


             reply	other threads:[~2020-04-28 13:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-28 13:22 Diego Nicola Barbato [this message]
2020-05-01 21:59 ` bug#40937: [PATCH] services: syslog: Simplify 'start' method Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tv13hhhp.fsf@GlaDOS.home \
    --to=dnbarbato@posteo.de \
    --cc=40937@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).