tftpd: Don't forget to close stderr on startup.

Just like stdin and stdout, stderr is a copy of the listen socket inherited from inetd.  We need to close it so inetd can process further requests, be restarted, etc.

Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D38968
This commit is contained in:
Dag-Erling Smørgrav 2023-03-10 13:24:50 +00:00
parent b4736c90ad
commit 77e83935b7

View file

@ -381,8 +381,9 @@ main(int argc, char *argv[])
me_sock.ss_family = peer_sock.ss_family;
me_sock.ss_len = peer_sock.ss_len;
}
close(0);
close(1);
close(STDIN_FILENO);
close(STDOUT_FILENO);
close(STDERR_FILENO);
peer = socket(peer_sock.ss_family, SOCK_DGRAM, 0);
if (peer < 0) {
tftp_log(LOG_ERR, "socket: %s", strerror(errno));