rpms/rpcbind/devel rpcbind-0.2.0-nofork.patch, NONE, 1.1 rpcbind.init, 1.11, 1.12 rpcbind.spec, 1.44, 1.45

Steve Dickson steved at fedoraproject.org
Tue Jul 13 20:17:56 UTC 2010


Author: steved

Update of /cvs/pkgs/rpms/rpcbind/devel
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv30431

Modified Files:
	rpcbind.init rpcbind.spec 
Added Files:
	rpcbind-0.2.0-nofork.patch 
Log Message:
- Made initscript LSB compliant (bz 614193)
- Added no fork patch


rpcbind-0.2.0-nofork.patch:
 man/rpcbind.8 |    2 ++
 src/rpcbind.c |   12 ++++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

--- NEW FILE rpcbind-0.2.0-nofork.patch ---
commit eb36cf198795b09c1ba796044fc99fa40c5a2b33
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Jul 13 15:52:18 2010 -0400

    rpcbind: add no-fork mode
    
    Signed-off-by: Lennart Poettering <lennart at poettering.net>
    Signed-off-by: Steve Dickson <steved at redhat.com>

diff --git a/man/rpcbind.8 b/man/rpcbind.8
index 32806d4..c5b8fb7 100644
--- a/man/rpcbind.8
+++ b/man/rpcbind.8
@@ -82,6 +82,8 @@ during operation, and will abort on certain errors if
 is also specified.
 With this option, the name-to-address translation consistency
 checks are shown in detail.
+.It Fl f
+Do not fork and become a background process.
 .It Fl h
 Specify specific IP addresses to bind to for UDP requests.
 This option
diff --git a/src/rpcbind.c b/src/rpcbind.c
index c8f0d9f..63023e1 100644
--- a/src/rpcbind.c
+++ b/src/rpcbind.c
@@ -77,6 +77,7 @@
 
 int debugging = 0;	/* Tell me what's going on */
 int doabort = 0;	/* When debugging, do an abort on errors */
+int dofork = 1;		/* fork? */
 
 rpcblist_ptr list_rbl;	/* A list of version 3/4 rpcbind services */
 
@@ -213,8 +214,8 @@ main(int argc, char *argv[])
 			printf("\n");
 		}
 #endif
-	} else {
-		if (daemon(0, 0)) 
+	} else if (dofork) {
+		if (daemon(0, 0))
         		err(1, "fork failed");
 	}
 
@@ -740,7 +741,7 @@ parseargs(int argc, char *argv[])
 {
 	int c;
 	oldstyle_local = 1;
-	while ((c = getopt(argc, argv, "adh:ilsw")) != -1) {
+	while ((c = getopt(argc, argv, "adh:ilswf")) != -1) {
 		switch (c) {
 		case 'a':
 			doabort = 1;	/* when debugging, do an abort on */
@@ -767,13 +768,16 @@ parseargs(int argc, char *argv[])
 		case 's':
 			runasdaemon = 1;
 			break;
+		case 'f':
+			dofork = 0;
+			break;
 #ifdef WARMSTART
 		case 'w':
 			warmstart = 1;
 			break;
 #endif
 		default:	/* error */
-			fprintf(stderr,	"usage: rpcbind [-adhilsw]\n");
+			fprintf(stderr,	"usage: rpcbind [-adhilswf]\n");
 			exit (1);
 		}
 	}


Index: rpcbind.init
===================================================================
RCS file: /cvs/pkgs/rpms/rpcbind/devel/rpcbind.init,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -p -r1.11 -r1.12
--- rpcbind.init	30 Sep 2008 18:24:16 -0000	1.11
+++ rpcbind.init	13 Jul 2010 20:17:56 -0000	1.12
@@ -12,7 +12,6 @@
 # config: /etc/sysconfig/rpcbind
 
 
-
 # This is an interactive program, we need the current locale
 [ -f /etc/profile.d/lang.sh ] && . /etc/profile.d/lang.sh
 # We can't Japanese on normal console at boot time, so force LANG=C.
@@ -25,23 +24,29 @@ fi
 # Source function library.
 . /etc/init.d/functions
 
+# Source networking configuration.
+[ -f /etc/sysconfig/network ] &&  . /etc/sysconfig/network
 
 prog="rpcbind"
 [ -f /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
 
 RETVAL=0
+uid=`id | cut -d\( -f1 | cut -d= -f2`
 
 start() {
-	# Get config.
-	if [ -f /etc/sysconfig/network ]; then
-		. /etc/sysconfig/network
-	else
-		exit 6
-	fi
 	# Check that networking is up.
 	[ "$NETWORKING" = "yes" ] || exit 6
+
 	[ -f /sbin/$prog ] || exit 5
 
+	# Make sure the rpcbind is not already running.
+	if status $prog > /dev/null ; then
+		exit 0	
+	fi
+
+	# Only root can start the service
+	[ $uid -ne 0 ] && exit 4
+
 	echo -n $"Starting $prog: "
 	daemon $prog $RPCBIND_ARGS $1
 	RETVAL=$?
@@ -74,19 +79,22 @@ case "$1" in
   status)
 	status $prog
 	;;
-  restart|reload)
-	stop
-	start
+  restart | reload| force-reload)
+	$0 stop
+	$0 start
+	RETVAL=$?
 	;;
-  condrestart)
+  condrestart | try-restart)
 	if [ -f /var/lock/subsys/$prog ]; then
-		stop
-		start -w
+		$0 stop
+		$0 start -w
+		RETVAL=$?
 	fi
 	;;
   *)
-	echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
-	exit 1
+	echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart|try-restart}"
+	RETVAL=2
+	;;
 esac
 
-exit $?
+exit $RETVAL


Index: rpcbind.spec
===================================================================
RCS file: /cvs/pkgs/rpms/rpcbind/devel/rpcbind.spec,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -p -r1.44 -r1.45
--- rpcbind.spec	6 Jul 2010 18:36:39 -0000	1.44
+++ rpcbind.spec	13 Jul 2010 20:17:56 -0000	1.45
@@ -2,7 +2,7 @@
 
 Name:           rpcbind
 Version:        0.2.0
-Release:	5%{?dist}
+Release:	6%{?dist}
 Summary:        Universal Addresses to RPC Program Number Mapper
 Group:          System Environment/Daemons
 License:        GPL
@@ -14,6 +14,7 @@ Source1: rpcbind.init
 
 Patch100: rpcbind-0.2.0-usage-fix.patch
 Patch101: rpcbind-0.2.0-soreuseaddr-listner.patch
+Patch102: rpcbind-0.2.0-nofork.patch
 
 Requires: glibc-common setup
 Conflicts: man-pages < 2.43-12
@@ -37,6 +38,7 @@ RPC calls on a server on that machine.
 %setup -q
 %patch100 -p1
 %patch101 -p1
+%patch102 -p1
 
 %build
 %ifarch s390 s390x
@@ -122,6 +124,10 @@ fi
 %dir %attr(700,rpc,rpc) /var/lib/rpcbind
 
 %changelog
+* Tue Jul 13 2010 Steve Dickson <steved at redhat.com> - 0.2.0-6
+- Made initscript LSB compliant (bz 614193)
+- Added no fork patch
+
 * Tue Jul  6 2010 Steve Dickson <steved at redhat.com> - 0.2.0-5
 - Set SO_REUSEADDR on listening sockets (bz 597356)
 



More information about the scm-commits mailing list