all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob 86fab56c646cb20b6d0dd72ca9210d202daa782f 1755 bytes (raw)
name: gnu/packages/patches/restartd-fix-segfault-normal-user.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
 
From 67d7308ba52d2c605d0175c14c34ff09c9d322fb Mon Sep 17 00:00:00 2001
From: Yin Kangkai <yinkangkai@xiaomi.com>
Date: Sat, 1 Oct 2016 13:52:58 +0800
Subject: [PATCH] Fix segfault when run as normal user

Also exit immediately when "restartd -h"
---
 restartd.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/restartd.c b/restartd.c
index 2aa720c..1d46fe1 100644
--- a/restartd.c
+++ b/restartd.c
@@ -118,6 +118,7 @@ int main(int argc, char *argv[])
                     "  -i <interval_sec>: the check interval in second\n"
                     "  -l               : list configuration options\n"
                     "  -h               : help\n\n", VERSION);
+	    exit(0);
         }
     }

@@ -187,6 +188,10 @@ int main(int argc, char *argv[])
         }

         out_proc = fopen("/var/run/restartd.pid", "wt");
+	if (!out_proc) {
+		syslog(LOG_ERR, "Failed to open /var/run/restartd.pid");
+		return -1;
+	}
         fprintf(out_proc, "%d", getpid());
         fclose(out_proc);

@@ -244,9 +249,9 @@ int main(int argc, char *argv[])
                if (strlen(config_process[i].processes) > 0) {
                    if (strlen(config_process[i].running) > 0) {
                        strcpy(config_process[i].status, "running");
-                       syslog(LOG_INFO, "%s is running, executing '%s'",
+                       /* syslog(LOG_INFO, "%s is running, executing '%s'",
                               config_process[i].name,
-                              config_process[i].running);
+                              config_process[i].running); */
                        system(config_process[i].running);
                     } else {
                         strcpy(config_process[i].status, "running");

debug log:

solving 5c28c3b2ad ...
found 5c28c3b2ad in https://yhetil.org/guix/87y1vck7le.fsf@ngraves.fr/

applying [1/1] https://yhetil.org/guix/87y1vck7le.fsf@ngraves.fr/
diff --git a/gnu/packages/patches/restartd-fix-segfault-normal-user.patch b/gnu/packages/patches/restartd-fix-segfault-normal-user.patch
new file mode 100644
index 0000000000..5c28c3b2ad

Checking patch gnu/packages/patches/restartd-fix-segfault-normal-user.patch...
Applied patch gnu/packages/patches/restartd-fix-segfault-normal-user.patch cleanly.

index at:
100644 86fab56c646cb20b6d0dd72ca9210d202daa782f	gnu/packages/patches/restartd-fix-segfault-normal-user.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.