artulab
projects
/
openbsd
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6d424a7
)
Don't call sysconf() in a loop conditional when the loop won't affect it
author
guenther
<guenther@openbsd.org>
Sun, 14 Aug 2016 19:45:24 +0000
(19:45 +0000)
committer
guenther
<guenther@openbsd.org>
Sun, 14 Aug 2016 19:45:24 +0000
(19:45 +0000)
ok natano@ tedu@
bin/csh/misc.c
patch
|
blob
|
history
diff --git
a/bin/csh/misc.c
b/bin/csh/misc.c
index
3a3ab32
..
d62b23d
100644
(file)
--- a/
bin/csh/misc.c
+++ b/
bin/csh/misc.c
@@
-1,4
+1,4
@@
-/* $OpenBSD: misc.c,v 1.1
8 2015/12/26 13:48:38 mestre Exp $
*/
+/* $OpenBSD: misc.c,v 1.1
9 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);