Add -f option to ftpd to stay in foreground with -D.
From nia in PR bin/53221.
This commit is contained in:
parent
2489795f85
commit
7bc66ed4ff
|
@ -1,4 +1,4 @@
|
||||||
.\" $NetBSD: ftpd.8,v 1.86 2017/07/03 21:35:48 wiz Exp $
|
.\" $NetBSD: ftpd.8,v 1.87 2018/04/28 13:38:00 riastradh Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 1997-2008 The NetBSD Foundation, Inc.
|
.\" Copyright (c) 1997-2008 The NetBSD Foundation, Inc.
|
||||||
.\" All rights reserved.
|
.\" All rights reserved.
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
Internet File Transfer Protocol server
|
Internet File Transfer Protocol server
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm
|
.Nm
|
||||||
.Op Fl 46DdHlnQqrsUuWwX
|
.Op Fl 46DdfHlnQqrsUuWwX
|
||||||
.Op Fl a Ar anondir
|
.Op Fl a Ar anondir
|
||||||
.Op Fl C Ar user Ns Op @ Ns Ar host
|
.Op Fl C Ar user Ns Op @ Ns Ar host
|
||||||
.Op Fl c Ar confdir
|
.Op Fl c Ar confdir
|
||||||
|
@ -154,6 +154,10 @@ for the
|
||||||
.Dq "\&%E"
|
.Dq "\&%E"
|
||||||
escape sequence (see
|
escape sequence (see
|
||||||
.Sx Display file escape sequences )
|
.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
|
.It Fl H
|
||||||
Equivalent to
|
Equivalent to
|
||||||
.Do
|
.Do
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: ftpd.c,v 1.203 2016/07/19 21:25:38 shm Exp $ */
|
/* $NetBSD: ftpd.c,v 1.204 2018/04/28 13:38:00 riastradh Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997-2009 The NetBSD Foundation, Inc.
|
* Copyright (c) 1997-2009 The NetBSD Foundation, Inc.
|
||||||
|
@ -97,7 +97,7 @@ __COPYRIGHT("@(#) Copyright (c) 1985, 1988, 1990, 1992, 1993, 1994\
|
||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)ftpd.c 8.5 (Berkeley) 4/28/95";
|
static char sccsid[] = "@(#)ftpd.c 8.5 (Berkeley) 4/28/95";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: ftpd.c,v 1.203 2016/07/19 21:25:38 shm Exp $");
|
__RCSID("$NetBSD: ftpd.c,v 1.204 2018/04/28 13:38:00 riastradh Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
|
@ -177,6 +177,7 @@ static sig_atomic_t urgflag;
|
||||||
|
|
||||||
int data;
|
int data;
|
||||||
int Dflag;
|
int Dflag;
|
||||||
|
int fflag;
|
||||||
int sflag;
|
int sflag;
|
||||||
int stru; /* avoid C keyword */
|
int stru; /* avoid C keyword */
|
||||||
int mode;
|
int mode;
|
||||||
|
@ -298,6 +299,7 @@ main(int argc, char *argv[])
|
||||||
logging = 0;
|
logging = 0;
|
||||||
pdata = -1;
|
pdata = -1;
|
||||||
Dflag = 0;
|
Dflag = 0;
|
||||||
|
fflag = 0;
|
||||||
sflag = 0;
|
sflag = 0;
|
||||||
dataport = 0;
|
dataport = 0;
|
||||||
dopidfile = 1; /* default: DO use a pid file to count users */
|
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);
|
openlog("ftpd", LOG_PID | LOG_NDELAY, LOG_FTP);
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv,
|
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) {
|
switch (ch) {
|
||||||
case '4':
|
case '4':
|
||||||
af = AF_INET;
|
af = AF_INET;
|
||||||
|
@ -377,6 +379,10 @@ main(int argc, char *argv[])
|
||||||
emailaddr = optarg;
|
emailaddr = optarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'f':
|
||||||
|
fflag = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
strlcpy(hostname, optarg, sizeof(hostname));
|
strlcpy(hostname, optarg, sizeof(hostname));
|
||||||
break;
|
break;
|
||||||
|
@ -505,7 +511,7 @@ main(int argc, char *argv[])
|
||||||
struct pollfd *fds;
|
struct pollfd *fds;
|
||||||
struct addrinfo hints, *res, *res0;
|
struct addrinfo hints, *res, *res0;
|
||||||
|
|
||||||
if (daemon(1, 0) == -1) {
|
if (!fflag && daemon(1, 0) == -1) {
|
||||||
syslog(LOG_ERR, "failed to daemonize: %m");
|
syslog(LOG_ERR, "failed to daemonize: %m");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue