MINOR: checks: use my_closefrom() to close all FDs

Instead of looping on all FDs, let's use my_closefrom() which does it
respecting the current process' limits and possibly doing it more
efficiently.
This commit is contained in:
Willy Tarreau 2019-02-21 22:22:06 +01:00
parent 2d7f81b809
commit 2555ccf4d0

View File

@ -1970,8 +1970,7 @@ static int connect_proc_chk(struct task *t)
/* close all FDs. Keep stdin/stdout/stderr in verbose mode */
fd = (global.mode & (MODE_QUIET|MODE_VERBOSE)) == MODE_QUIET ? 0 : 3;
while (fd < global.rlimit_nofile)
close(fd++);
my_closefrom(fd);
environ = check->envp;
extchk_setenv(check, EXTCHK_HAPROXY_SERVER_CURCONN, ultoa_r(s->cur_sess, buf, sizeof(buf)));