From d54cfbd18e97fb6c38f03984fe0a7305d84ade07 Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Mon, 29 Jan 2018 01:05:57 +0000 Subject: [PATCH] ftp(1): Use closefrom() instead of individual close()s. Use closefrom(3) instead of manually closing all file descriptors between 3 and 19. Obtained from: OpenBSD (CVS 1.80) --- contrib/tnftp/src/cmds.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/contrib/tnftp/src/cmds.c b/contrib/tnftp/src/cmds.c index 7be3a7782a17..a92d8c5672b6 100644 --- a/contrib/tnftp/src/cmds.c +++ b/contrib/tnftp/src/cmds.c @@ -1438,8 +1438,7 @@ shell(int argc, char *argv[]) } oldintr = xsignal(SIGINT, SIG_IGN); if ((pid = fork()) == 0) { - for (pid = 3; pid < 20; pid++) - (void)close(pid); + (void)closefrom(3); (void)xsignal(SIGINT, SIG_DFL); shellp = getenv("SHELL"); if (shellp == NULL)