summaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorLeonardo Arena <rnalrd@alpinelinux.org>2013-01-25 10:09:15 +0000
committerLeonardo Arena <rnalrd@alpinelinux.org>2013-01-25 10:10:10 +0000
commitd5946d282057bff37f44a894174ae30be5cf19cf (patch)
treee70cd780d12f15903060ae7b78021aa8c26aa913 /testing
parentc47c4ad0e4ca3903bd7e1f5c25155e33dffc1169 (diff)
downloadaports-d5946d282057bff37f44a894174ae30be5cf19cf.tar.bz2
aports-d5946d282057bff37f44a894174ae30be5cf19cf.tar.xz
testing/fprobe-ulog: fix piddir creation when in chroot
Diffstat (limited to 'testing')
-rw-r--r--testing/fprobe-ulog/APKBUILD16
-rw-r--r--testing/fprobe-ulog/fprobe-1.1-pidfile-sanity.patch48
-rwxr-xr-xtesting/fprobe-ulog/fprobe-ulog.initd6
3 files changed, 60 insertions, 10 deletions
diff --git a/testing/fprobe-ulog/APKBUILD b/testing/fprobe-ulog/APKBUILD
index 750375918..76c665c87 100644
--- a/testing/fprobe-ulog/APKBUILD
+++ b/testing/fprobe-ulog/APKBUILD
@@ -1,7 +1,7 @@
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=fprobe-ulog
pkgver=1.1
-pkgrel=0
+pkgrel=1
pkgdesc="netfilter-based tool that collect network traffic"
url="http://fprobe.sourceforge.net/"
arch="all"
@@ -13,17 +13,18 @@ subpackages="$pkgname-doc"
source="http://downloads.sourceforge.net/project/fprobe/$pkgname/$pkgver/$pkgname-1.1.tar.bz2
fprobe-ulog.confd
fprobe-ulog.initd
+ fprobe-1.1-pidfile-sanity.patch
"
_builddir="$srcdir"/$pkgname-$pkgver
prepare() {
cd $_builddir
-# for i in ../*.patch
-# do
-# msg "Applying $i"
-# patch -p1 < ../$i || exit 1
-# done
+ for i in ../*.patch
+ do
+ msg "Applying $i"
+ patch -p1 < ../$i || exit 1
+ done
}
build() {
@@ -46,4 +47,5 @@ package() {
md5sums="cdb2e4edc47e8a3d5479eeabfb979ebc fprobe-ulog-1.1.tar.bz2
a92104da52c99532d1d01007b78940fc fprobe-ulog.confd
-bc878e47b44fbd71bd594206a4384c12 fprobe-ulog.initd"
+744975c055421223940a278517b34d47 fprobe-ulog.initd
+f1316ad835c1a2b6565b4dc448b022df fprobe-1.1-pidfile-sanity.patch"
diff --git a/testing/fprobe-ulog/fprobe-1.1-pidfile-sanity.patch b/testing/fprobe-ulog/fprobe-1.1-pidfile-sanity.patch
new file mode 100644
index 000000000..5f7b79bd8
--- /dev/null
+++ b/testing/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);
diff --git a/testing/fprobe-ulog/fprobe-ulog.initd b/testing/fprobe-ulog/fprobe-ulog.initd
index f79579484..d8f5c9acf 100755
--- a/testing/fprobe-ulog/fprobe-ulog.initd
+++ b/testing/fprobe-ulog/fprobe-ulog.initd
@@ -9,10 +9,10 @@ depend() {
PIDFILE_EXTRA=""
[ -n "$PIDFILE_ID" ] && PIDFILE_EXTRA="[$PIDFILE_ID]"
-PIDFILE="/var/run/fprobe$PIDFILE_EXTRA.pid"
+PIDFILE="/var/run/fprobe-ulog$PIDFILE_EXTRA.pid"
start() {
- ebegin "Starting fprobe"
+ ebegin "Starting fprobe-ulog"
local OPTS=""
set --
[ -n "${FILTER}" ] && set -- -f "${FILTER}"
@@ -32,7 +32,7 @@ start() {
}
stop() {
- ebegin "Stopping fprobe"
+ ebegin "Stopping fprobe-ulog"
start-stop-daemon --stop --quiet --exec $DAEMON \
--pidfile ${PIDFILE}
eend $?