diff --git a/usr.sbin/rpcbind/rpcbind.8 b/usr.sbin/rpcbind/rpcbind.8 --- a/usr.sbin/rpcbind/rpcbind.8 +++ b/usr.sbin/rpcbind/rpcbind.8 @@ -1,7 +1,7 @@ .\" @(#)rpcbind.1m 1.19 92/09/14 SMI; from SVr4 .\" Copyright 1989 AT&T .\" Copyright 1991 Sun Microsystems, Inc. -.Dd April 19, 2017 +.Dd August 31, 2023 .Dt RPCBIND 8 .Os .Sh NAME @@ -9,7 +9,7 @@ .Nd universal addresses to RPC program number mapper .Sh SYNOPSIS .Nm -.Op Fl 6adiLlswW +.Op Fl 6adiLlNswW .Op Fl h Ar bindip .Sh DESCRIPTION The @@ -122,6 +122,11 @@ .Pa /var/run/rpcbind.sock . .It Fl l Turn on libwrap connection logging. +.It Fl N +Run in foreground mode. +In this mode, +.Nm +will not fork when it starts. .It Fl s Cause .Nm diff --git a/usr.sbin/rpcbind/rpcbind.c b/usr.sbin/rpcbind/rpcbind.c --- a/usr.sbin/rpcbind/rpcbind.c +++ b/usr.sbin/rpcbind/rpcbind.c @@ -94,6 +94,7 @@ #ifdef LIBWRAP int libwrap = 0; #endif +int nofork = 0; int verboselog = 0; static char **hosts = NULL; @@ -226,7 +227,7 @@ } else { printf("\n"); } - } else { + } else if (!nofork) { if (daemon(0, 0)) err(1, "fork failed"); } @@ -809,7 +810,7 @@ #else #define WRAPOP "" #endif - while ((c = getopt(argc, argv, "6adh:iLls" WRAPOP WSOP)) != -1) { + while ((c = getopt(argc, argv, "6adh:iLlNs" WRAPOP WSOP)) != -1) { switch (c) { case '6': ipv6_only = 1; @@ -839,6 +840,9 @@ case 'l': verboselog = 1; break; + case 'N': + nofork = 1; + break; case 's': runasdaemon = 1; break;