forked from rpms/rpcbind
73 lines
1.9 KiB
Diff
73 lines
1.9 KiB
Diff
commit eb36cf198795b09c1ba796044fc99fa40c5a2b33
|
|
Author: Lennart Poettering <lennart@poettering.net>
|
|
Date: Tue Jul 13 15:52:18 2010 -0400
|
|
|
|
rpcbind: add no-fork mode
|
|
|
|
Signed-off-by: Lennart Poettering <lennart@poettering.net>
|
|
Signed-off-by: Steve Dickson <steved@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);
|
|
}
|
|
}
|