summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2016-08-14 19:45:24 +0000
committerguenther <guenther@openbsd.org>2016-08-14 19:45:24 +0000
commitadf3ff49aed68f420fda489b6591e36b75e5c843 (patch)
tree0102204e531648e4876d2b8999ca9ea7b9e2b3a9
parenttweak previous; (diff)
downloadwireguard-openbsd-adf3ff49aed68f420fda489b6591e36b75e5c843.tar.xz
wireguard-openbsd-adf3ff49aed68f420fda489b6591e36b75e5c843.zip
Don't call sysconf() in a loop conditional when the loop won't affect it
ok natano@ tedu@
-rw-r--r--bin/csh/misc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/csh/misc.c b/bin/csh/misc.c
index 3a3ab323090..d62b23db6e6 100644
--- a/bin/csh/misc.c
+++ b/bin/csh/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.18 2015/12/26 13:48:38 mestre Exp $ */
+/* $OpenBSD: misc.c,v 1.19 2016/08/14 19:45:24 guenther Exp $ */
/* $NetBSD: misc.c,v 1.6 1995/03/21 09:03:09 cgd Exp $ */
/*-
@@ -170,8 +170,9 @@ void
closem(void)
{
int f;
+ int max = sysconf(_SC_OPEN_MAX);
- for (f = 0; f < sysconf(_SC_OPEN_MAX); f++)
+ for (f = 0; f < max; f++)
if (f != SHIN && f != SHOUT && f != SHERR && f != OLDSTD &&
f != FSHTTY)
(void) close(f);