summaryrefslogtreecommitdiffstats
path: root/main/fprobe-ulog/fprobe-1.1-pidfile-sanity.patch
diff options
context:
space:
mode:
authorLeonardo Arena <rnalrd@alpinelinux.org>2013-01-25 10:30:47 +0000
committerLeonardo Arena <rnalrd@alpinelinux.org>2013-01-25 10:30:47 +0000
commitbbc44c2661a07cb8ccd4cbd783bd0e99460bea8d (patch)
tree54243360723660cdecbf95286e85a1a33111c042 /main/fprobe-ulog/fprobe-1.1-pidfile-sanity.patch
parentd5946d282057bff37f44a894174ae30be5cf19cf (diff)
downloadaports-bbc44c2661a07cb8ccd4cbd783bd0e99460bea8d.tar.bz2
aports-bbc44c2661a07cb8ccd4cbd783bd0e99460bea8d.tar.xz
testing/fprobe-ulog: move to main
Diffstat (limited to 'main/fprobe-ulog/fprobe-1.1-pidfile-sanity.patch')
-rw-r--r--main/fprobe-ulog/fprobe-1.1-pidfile-sanity.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/main/fprobe-ulog/fprobe-1.1-pidfile-sanity.patch b/main/fprobe-ulog/fprobe-1.1-pidfile-sanity.patch
new file mode 100644
index 000000000..5f7b79bd8
--- /dev/null
+++ b/main/fprobe-ulog/fprobe-1.1-pidfile-sanity.patch
@@ -0,0 +1,48 @@
+If we are using the chroot() option or the setuid options, we must create the
+pidfile before doing the chroot OR the setreuid. It's actually best for
+start-stop-daemon if we create the pidfile from the master side of the fork()
+before it exits, since most of the startup checks happen after the chroot()
+unfortunetly.
+
+Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
+
+diff -Nuar fprobe-1.1.orig/src/fprobe.c fprobe-1.1/src/fprobe.c
+--- fprobe-1.1.orig/src/fprobe-ulog.c 2005-01-30 08:43:35.000000000 +0000
++++ fprobe-1.1/src/fprobe-ulog.c 2008-03-16 20:51:24.000000000 +0000
+@@ -1379,7 +1379,8 @@
+
+ my_log_open(ident, verbosity, log_dest);
+ if (!(log_dest & 2)) {
+- switch (fork()) {
++ pid_t childpid = fork();
++ switch (childpid) {
+ case -1:
+ fprintf(stderr, "fork(): %s", strerror(errno));
+ exit(1);
+@@ -1392,6 +1393,12 @@
+ break;
+
+ default:
++ if (!(pidfile = fopen(pidfilepath, "w")))
++ my_log(LOG_ERR, "Can't create pid file. fopen(): %s", strerror(errno));
++ else {
++ fprintf(pidfile, "%ld\n", (long) childpid);
++ fclose(pidfile);
++ }
+ exit(0);
+ }
+ } else {
+@@ -1548,13 +1555,6 @@
+ }
+ }
+
+- if (!(pidfile = fopen(pidfilepath, "w")))
+- my_log(LOG_ERR, "Can't create pid file. fopen(): %s", strerror(errno));
+- else {
+- fprintf(pidfile, "%ld\n", (long) pid);
+- fclose(pidfile);
+- }
+-
+ my_log(LOG_INFO, "pid: %d", pid);
+ my_log(LOG_INFO, "interface: %s, datalink: %s (%d)",
+ dev, dlt[link_type_idx].descr, link_type);