]> git.pld-linux.org Git - packages/rpcbind.git/blob - rpcbind-nofork.patch
- rel 6
[packages/rpcbind.git] / rpcbind-nofork.patch
1 commit eb36cf198795b09c1ba796044fc99fa40c5a2b33
2 Author: Steve Dickson <steved@redhat.com>
3 Date:   Tue Jul 13 15:52:18 2010 -0400
4
5     rpcbind: add no-fork mode
6     
7     Signed-off-by: Lennart Poettering <lennart@poettering.net>
8     Signed-off-by: Steve Dickson <steved@redhat.com>
9
10 diff --git a/man/rpcbind.8 b/man/rpcbind.8
11 index 32806d4..c5b8fb7 100644
12 --- a/man/rpcbind.8
13 +++ b/man/rpcbind.8
14 @@ -82,6 +82,8 @@ during operation, and will abort on certain errors if
15  is also specified.
16  With this option, the name-to-address translation consistency
17  checks are shown in detail.
18 +.It Fl f
19 +Do not fork and become a background process.
20  .It Fl h
21  Specify specific IP addresses to bind to for UDP requests.
22  This option
23 diff --git a/src/rpcbind.c b/src/rpcbind.c
24 index c8f0d9f..63023e1 100644
25 --- a/src/rpcbind.c
26 +++ b/src/rpcbind.c
27 @@ -77,6 +77,7 @@
28  
29  int debugging = 0;     /* Tell me what's going on */
30  int doabort = 0;       /* When debugging, do an abort on errors */
31 +int dofork = 1;                /* fork? */
32  
33  rpcblist_ptr list_rbl; /* A list of version 3/4 rpcbind services */
34  
35 @@ -213,8 +214,8 @@ main(int argc, char *argv[])
36                         printf("\n");
37                 }
38  #endif
39 -       } else {
40 -               if (daemon(0, 0)) 
41 +       } else if (dofork) {
42 +               if (daemon(0, 0))
43                         err(1, "fork failed");
44         }
45  
46 @@ -740,7 +741,7 @@ parseargs(int argc, char *argv[])
47  {
48         int c;
49         oldstyle_local = 1;
50 -       while ((c = getopt(argc, argv, "adh:ilsw")) != -1) {
51 +       while ((c = getopt(argc, argv, "adh:ilswf")) != -1) {
52                 switch (c) {
53                 case 'a':
54                         doabort = 1;    /* when debugging, do an abort on */
55 @@ -767,13 +768,16 @@ parseargs(int argc, char *argv[])
56                 case 's':
57                         runasdaemon = 1;
58                         break;
59 +               case 'f':
60 +                       dofork = 0;
61 +                       break;
62  #ifdef WARMSTART
63                 case 'w':
64                         warmstart = 1;
65                         break;
66  #endif
67                 default:        /* error */
68 -                       fprintf(stderr, "usage: rpcbind [-adhilsw]\n");
69 +                       fprintf(stderr, "usage: rpcbind [-adhilswf]\n");
70                         exit (1);
71                 }
72         }
This page took 0.066378 seconds and 3 git commands to generate.