summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Dickson <steved@redhat.com>2010-07-13 15:52:18 -0400
committerSteve Dickson <steved@redhat.com>2010-07-13 15:52:18 -0400
commiteb36cf198795b09c1ba796044fc99fa40c5a2b33 (patch)
tree0b80367efbe651542e9f37cfddbec45288677793
parent68556dc512493868960b367406e04d7169c003a8 (diff)
downloadrpcbind-eb36cf198795b09c1ba796044fc99fa40c5a2b33.tar.gz
rpcbind: add no-fork moderpcbind-0_2_1-rc1
Signed-off-by: Lennart Poettering <lennart@poettering.net> Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r--man/rpcbind.82
-rw-r--r--src/rpcbind.c12
2 files changed, 10 insertions, 4 deletions
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);
}
}