Module Name:    src
Committed By:   martin
Date:           Tue Oct  3 09:54:24 UTC 2023

Modified Files:
        src/libexec/ftpd [netbsd-8]: ftpd.8 ftpd.c

Log Message:
Pull up following revision(s) (requested by lukem in ticket #1900):

        libexec/ftpd/ftpd.8: revision 1.87
        libexec/ftpd/ftpd.c: revision 1.204

Add -f option to ftpd to stay in foreground with -D.

>From nia in PR bin/53221.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.85.38.1 src/libexec/ftpd/ftpd.8
cvs rdiff -u -r1.203 -r1.203.6.1 src/libexec/ftpd/ftpd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/ftpd/ftpd.8
diff -u src/libexec/ftpd/ftpd.8:1.85 src/libexec/ftpd/ftpd.8:1.85.38.1
--- src/libexec/ftpd/ftpd.8:1.85	Fri May  1 10:53:27 2009
+++ src/libexec/ftpd/ftpd.8	Tue Oct  3 09:54:24 2023
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ftpd.8,v 1.85 2009/05/01 10:53:27 wiz Exp $
+.\"	$NetBSD: ftpd.8,v 1.85.38.1 2023/10/03 09:54:24 martin Exp $
 .\"
 .\" Copyright (c) 1997-2008 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -65,7 +65,7 @@
 Internet File Transfer Protocol server
 .Sh SYNOPSIS
 .Nm
-.Op Fl 46DdHlnQqrsUuWwX
+.Op Fl 46DdfHlnQqrsUuWwX
 .Op Fl a Ar anondir
 .Op Fl C Ar user Ns Op @ Ns Ar host
 .Op Fl c Ar confdir
@@ -154,6 +154,10 @@ for the
 .Dq "\&%E"
 escape sequence (see
 .Sx Display file escape sequences )
+.It Fl f
+Stops the
+.Fl D
+flag from detaching from the tty and going into the background.
 .It Fl H
 Equivalent to
 .Do

Index: src/libexec/ftpd/ftpd.c
diff -u src/libexec/ftpd/ftpd.c:1.203 src/libexec/ftpd/ftpd.c:1.203.6.1
--- src/libexec/ftpd/ftpd.c:1.203	Tue Jul 19 21:25:38 2016
+++ src/libexec/ftpd/ftpd.c	Tue Oct  3 09:54:24 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ftpd.c,v 1.203 2016/07/19 21:25:38 shm Exp $	*/
+/*	$NetBSD: ftpd.c,v 1.203.6.1 2023/10/03 09:54:24 martin Exp $	*/
 
 /*
  * Copyright (c) 1997-2009 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@ __COPYRIGHT("@(#) Copyright (c) 1985, 19
 #if 0
 static char sccsid[] = "@(#)ftpd.c	8.5 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: ftpd.c,v 1.203 2016/07/19 21:25:38 shm Exp $");
+__RCSID("$NetBSD: ftpd.c,v 1.203.6.1 2023/10/03 09:54:24 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -177,6 +177,7 @@ static sig_atomic_t	urgflag;
 
 int	data;
 int	Dflag;
+int	fflag;
 int	sflag;
 int	stru;			/* avoid C keyword */
 int	mode;
@@ -298,6 +299,7 @@ main(int argc, char *argv[])
 	logging = 0;
 	pdata = -1;
 	Dflag = 0;
+	fflag = 0;
 	sflag = 0;
 	dataport = 0;
 	dopidfile = 1;		/* default: DO use a pid file to count users */
@@ -323,7 +325,7 @@ main(int argc, char *argv[])
 	openlog("ftpd", LOG_PID | LOG_NDELAY, LOG_FTP);
 
 	while ((ch = getopt(argc, argv,
-	    "46a:c:C:Dde:h:HlL:nP:qQrst:T:uUvV:wWX")) != -1) {
+	    "46a:c:C:Dde:fh:HlL:nP:qQrst:T:uUvV:wWX")) != -1) {
 		switch (ch) {
 		case '4':
 			af = AF_INET;
@@ -377,6 +379,10 @@ main(int argc, char *argv[])
 			emailaddr = optarg;
 			break;
 
+		case 'f':
+			fflag = 1;
+			break;
+
 		case 'h':
 			strlcpy(hostname, optarg, sizeof(hostname));
 			break;
@@ -505,7 +511,7 @@ main(int argc, char *argv[])
 		struct pollfd *fds;
 		struct addrinfo hints, *res, *res0;
 
-		if (daemon(1, 0) == -1) {
+		if (!fflag && daemon(1, 0) == -1) {
 			syslog(LOG_ERR, "failed to daemonize: %m");
 			exit(1);
 		}

Reply via email to