git: 77e83935b7ef - main - tftpd: Don't forget to close stderr on startup.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 10 Mar 2023 13:29:23 UTC
The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=77e83935b7efb0d881fdb77117eb992e807ed9d7 commit 77e83935b7efb0d881fdb77117eb992e807ed9d7 Author: Dag-Erling Smørgrav <des@FreeBSD.org> AuthorDate: 2023-03-10 13:24:50 +0000 Commit: Dag-Erling Smørgrav <des@FreeBSD.org> CommitDate: 2023-03-10 13:25:16 +0000 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 --- libexec/tftpd/tftpd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libexec/tftpd/tftpd.c b/libexec/tftpd/tftpd.c index 8e3d2e13f320..b25e8b0c762f 100644 --- a/libexec/tftpd/tftpd.c +++ b/libexec/tftpd/tftpd.c @@ -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));