Subject: bin/12823: inetd might want to run in foreground without debugging output
To: None <gnats-bugs@gnats.netbsd.org>
From: The Grey Wolf <greywolf@starwolf.com>
List: netbsd-bugs
Date: 05/03/2001 16:00:33
>Number:         12823
>Category:       bin
>Synopsis:       request for addition of -f flag to inetd
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu May 03 16:00:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        current of 3 May 2001
>Organization:
Star Wolf Innovations

				--*greywolf;
--
*BSD: No Worries!
>Environment:
	N/A
System: NetBSD starjumper 1.5S NetBSD 1.5S (STARJUMPER) #2: Thu Feb 22 19:10:50 PST 2001 root@:/export/src/sys/arch/i386/compile/STARJUMPER i386
Architecture: i386
Machine: i386
>Description:
	inetd has a -d flag which produces debugging output while preventing
	detaching from its controlling terminal; sometimes it might be nice
	to have it sit in foreground without all that information (put a
	wrapper around it and catch a signal as to why it is dying, for
	example).  Patches included.

	I realise this may seem kind of silly, but the important daemons
	of which I know have a way of separating debugging from detachment.

>How-To-Repeat:
	N/A
>Fix:
--- inetd.c	Thu May  3 15:51:44 2001
+++ inetd.c.orig	Thu May  3 15:41:45 2001
@@ -271,7 +271,6 @@
 #ifdef LIBWRAP
 int	lflag;
 #endif
-int	foreground;
 int	nsock, maxsock;
 fd_set	allsock;
 int	options;
@@ -454,9 +453,9 @@
 
 	while ((ch = getopt(argc, argv,
 #ifdef LIBWRAP
-					"dlf"
+					"dl"
 #else
-					"df"
+					"d"
 #endif
 					   )) != -1)
 		switch(ch) {
@@ -469,9 +468,6 @@
 			lflag = 1;
 			break;
 #endif
-		case 'f':
-			foreground = 1;
-			break;
 		case '?':
 		default:
 			usage();
@@ -482,7 +478,7 @@
	if (argc > 0)
 		CONFIG = argv[0];
 
-	if (debug == 0 && foreground == 0)
+	if (debug == 0)
 		daemon(0, 0);
 	openlog("inetd", LOG_PID | LOG_NOWAIT, LOG_DAEMON);
 	pidfile(NULL);
@@ -2111,9 +2107,9 @@
 {
 
 #ifdef LIBWRAP
-	(void)fprintf(stderr, "usage: %s [-dfl] [conf]\n", getprogname());
+	(void)fprintf(stderr, "usage: %s [-dl] [conf]\n", getprogname());
 #else
-	(void)fprintf(stderr, "usage: %s [-df] [conf]\n", getprogname());
+	(void)fprintf(stderr, "usage: %s [-d] [conf]\n", getprogname());
 #endif
 	exit(1);
 }

--- inetd.8	Thu May  3 15:51:38 2001
+++ inetd.8.orig	Fri Mar 23 22:17:39 2001
@@ -79,7 +79,6 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl d
-.Op Fl f
 .Op Fl l
 .Op Ar configuration file
 .Sh DESCRIPTION
@@ -105,11 +104,6 @@
 .Bl -tag -width Ds
 .It Fl d
 Turns on debugging.
-.El
-.Pp
-.Bl -tag -width Ds
-.It Fl f
-Keeps inetd in the foreground but without verbose debugging output.
 .El
 .Pp
 .Bl -tag -width Ds
>Release-Note:
>Audit-Trail:
>Unformatted: