[rbldnsd] Fix return value from initscript (#1118013)
Paul Howarth
pghmcfc at fedoraproject.org
Thu Jul 10 11:01:17 UTC 2014
commit 0e27bd1dd5ca61bcd0eb699a146dcbc1d70cbcc8
Author: Paul Howarth <paul at city-fan.org>
Date: Thu Jul 10 12:00:02 2014 +0100
Fix return value from initscript (#1118013)
- Fix return value from initscript, by using process substitution instead of
a while loop at the end of a pipe (#1118013)
- Drop %defattr, redundant since rpm 4.4
rbldnsctl | 39 +++++++++++++++++++--------------------
rbldnsd.init | 57 ++++++++++++++++++++++++++++-----------------------------
rbldnsd.spec | 12 ++++++++----
3 files changed, 55 insertions(+), 53 deletions(-)
---
diff --git a/rbldnsctl b/rbldnsctl
index 75b4808..cc9e181 100755
--- a/rbldnsctl
+++ b/rbldnsctl
@@ -58,27 +58,26 @@ set_status() {
# Process multiple instances of the daemon (see /etc/sysconfig/rbldnsd)
for_all_daemons() {
ret=0
- echo "$RBLDNSD" |
- while read name args; do
- # For a single instance (name = "-"), use "single" as name
- case "$name" in
- ""|\#*) continue;;
- -) name=single;;
- *) ;;
- esac
- # Process this instance
- $1
- thisret=$?
- if [ "$1" = "check_one_daemon" -o "$1" = "reload_one_daemon" ]; then
- if [ $thisret -ne 0 ]; then
- ret=$thisret
- fi
- else
- if [ $thisret -ne 0 ]; then
- ret=1
- fi
+ while read name args; do
+ # For a single instance (name = "-"), use "single" as name
+ case "$name" in
+ ""|\#*) continue;;
+ -) name=single;;
+ *) ;;
+ esac
+ # Process this instance
+ $1
+ thisret=$?
+ if [ "$1" = "check_one_daemon" -o "$1" = "reload_one_daemon" ]; then
+ if [ $thisret -ne 0 ]; then
+ ret=$thisret
fi
- done
+ else
+ if [ $thisret -ne 0 ]; then
+ ret=1
+ fi
+ fi
+ done < <(echo "$RBLDNSD")
set_status $ret
}
diff --git a/rbldnsd.init b/rbldnsd.init
index cb333a8..be76ad4 100644
--- a/rbldnsd.init
+++ b/rbldnsd.init
@@ -45,37 +45,36 @@ set_status() {
# Process multiple instances of the daemon (see /etc/sysconfig/rbldnsd)
for_all_daemons() {
ret=0
- echo "$RBLDNSD" |
- while read name args; do
- # generate pidfile name from key
- case "$name" in
- ""|\#*) continue;;
- -) name=$prog; pidfile=/var/run/$name.pid;;
- *) pidfile=/var/run/rbldnsd-$name.pid;;
- esac
- # if pidfile exists, get pid and check for running rbldnsd
- pid=
- if [ -f $pidfile ]; then
- read p < $pidfile
- if [ -n "$p" -a -f /proc/$p/cmdline ]; then
- case "`cat /proc/$p/cmdline 2>/dev/null`" in
- *$prog*) pid=$p;;
- esac
- fi
+ while read name args; do
+ # generate pidfile name from key
+ case "$name" in
+ ""|\#*) continue;;
+ -) name=$prog; pidfile=/var/run/$name.pid;;
+ *) pidfile=/var/run/rbldnsd-$name.pid;;
+ esac
+ # if pidfile exists, get pid and check for running rbldnsd
+ pid=
+ if [ -f $pidfile ]; then
+ read p < $pidfile
+ if [ -n "$p" -a -f /proc/$p/cmdline ]; then
+ case "`cat /proc/$p/cmdline 2>/dev/null`" in
+ *$prog*) pid=$p;;
+ esac
fi
- # Start/stop this daemon
- $1
- thisret=$?
- if [ "$1" = "check_one_daemon" -o "$1" = "reload_one_daemon" ]; then
- if [ $thisret -ne 0 ]; then
- ret=$thisret
- fi
- else
- if [ $thisret -ne 0 ]; then
- ret=1
- fi
+ fi
+ # Start/stop this daemon
+ $1
+ thisret=$?
+ if [ "$1" = "check_one_daemon" -o "$1" = "reload_one_daemon" ]; then
+ if [ $thisret -ne 0 ]; then
+ ret=$thisret
+ fi
+ else
+ if [ $thisret -ne 0 ]; then
+ ret=1
fi
- done
+ fi
+ done < <(echo "$RBLDNSD")
set_status $ret
}
diff --git a/rbldnsd.spec b/rbldnsd.spec
index 93150f1..566976b 100644
--- a/rbldnsd.spec
+++ b/rbldnsd.spec
@@ -11,7 +11,7 @@
Summary: Small, fast daemon to serve DNSBLs
Name: rbldnsd
Version: 0.997a
-Release: 3%{?dist}
+Release: 4%{?dist}
License: GPLv2+
Group: System Environment/Daemons
URL: http://www.corpit.ru/mjt/rbldnsd.html
@@ -124,7 +124,6 @@ if [ $1 -ge 1 ]; then
fi
%files
-%defattr (-,root,root,-)
%doc README.user NEWS TODO debian/changelog CHANGES-0.81
%{_sbindir}/rbldnsd
%{_mandir}/man8/rbldnsd.8*
@@ -139,8 +138,13 @@ fi
%endif
%changelog
-* Sun Jun 08 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.997a-3
-- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
+* Thu Jul 10 2014 Paul Howarth <paul at city-fan.org> 0.997a-4
+- fix return value from initscript, by using process substitution instead of
+ a while loop at the end of a pipe (#1118013)
+- drop %%defattr, redundant since rpm 4.4
+
+* Sun Jun 8 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> 0.997a-3
+- rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Thu Nov 21 2013 Paul Howarth <paul at city-fan.org> 0.997a-2
- use format string in dslog() invocation
More information about the scm-commits
mailing list