upstream: aggressively pre-fill the pollfd array with fd=-1

OpenBSD-Commit-ID: c2a525de8f83c1a04405bd79122c424140552a5b
This commit is contained in:
deraadt@openbsd.org 2021-11-12 05:23:49 +00:00 committed by Damien Miller
parent 7eec76793d
commit 06acb04c20
1 changed files with 3 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ssh-keyscan.c,v 1.141 2021/11/11 15:32:32 deraadt Exp $ */ /* $OpenBSD: ssh-keyscan.c,v 1.142 2021/11/12 05:23:49 deraadt Exp $ */
/* /*
* Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>. * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>.
* *
@ -773,6 +773,8 @@ main(int argc, char **argv)
fdlim_set(maxfd); fdlim_set(maxfd);
fdcon = xcalloc(maxfd, sizeof(con)); fdcon = xcalloc(maxfd, sizeof(con));
read_wait = xcalloc(maxfd, sizeof(struct pollfd)); read_wait = xcalloc(maxfd, sizeof(struct pollfd));
for (j = 0; j < maxfd; j++)
read_wait[j].fd = -1;
for (j = 0; j < fopt_count; j++) { for (j = 0; j < fopt_count; j++) {
if (argv[j] == NULL) if (argv[j] == NULL)