From 932137c010ae143a4951a73414b6f779d51a29c5 Mon Sep 17 00:00:00 2001 From: tb Date: Wed, 24 Jan 2018 13:25:25 +0000 Subject: [PATCH] Use closefrom(3) instead of manually closing all file descriptors between 3 and 19. ok martijn, millert, jca --- usr.bin/ftp/cmds.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/usr.bin/ftp/cmds.c b/usr.bin/ftp/cmds.c index e4d0db1ece3..e47c8bf1da3 100644 --- a/usr.bin/ftp/cmds.c +++ b/usr.bin/ftp/cmds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmds.c,v 1.79 2017/01/21 08:33:07 krw Exp $ */ +/* $OpenBSD: cmds.c,v 1.80 2018/01/24 13:25:25 tb Exp $ */ /* $NetBSD: cmds.c,v 1.27 1997/08/18 10:20:15 lukem Exp $ */ /* @@ -987,8 +987,7 @@ shell(int argc, char *argv[]) old1 = signal (SIGINT, SIG_IGN); old2 = signal (SIGQUIT, SIG_IGN); if ((pid = fork()) == 0) { - for (pid = 3; pid < 20; pid++) - (void)close(pid); + (void)closefrom(3); (void)signal(SIGINT, SIG_DFL); (void)signal(SIGQUIT, SIG_DFL); shellp = getenv("SHELL"); -- 2.20.1