summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/freopen.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2019-06-29 16:12:21 +0000
committerderaadt <deraadt@openbsd.org>2019-06-29 16:12:21 +0000
commit97f9487f1c5fa94def48ac042586907cfbc4a1e1 (patch)
treebf8f178ae208a9dc7b3bd785e01e97d506bf49ec /lib/libc/stdio/freopen.c
parentvariable ver is unused; rdpr %ver is always used instead; from miod (diff)
downloadwireguard-openbsd-97f9487f1c5fa94def48ac042586907cfbc4a1e1.tar.xz
wireguard-openbsd-97f9487f1c5fa94def48ac042586907cfbc4a1e1.zip
two more syscall == -1 checks
Diffstat (limited to 'lib/libc/stdio/freopen.c')
-rw-r--r--lib/libc/stdio/freopen.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/stdio/freopen.c b/lib/libc/stdio/freopen.c
index 3d4f8421301..65065e54d7d 100644
--- a/lib/libc/stdio/freopen.c
+++ b/lib/libc/stdio/freopen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: freopen.c,v 1.16 2016/09/21 04:38:56 guenther Exp $ */
+/* $OpenBSD: freopen.c,v 1.17 2019/06/29 16:12:21 deraadt Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -88,7 +88,7 @@ freopen(const char *file, const char *mode, FILE *fp)
/* Get a new descriptor to refer to the new file. */
f = open(file, oflags, DEFFILEMODE);
- if (f < 0 && isopen) {
+ if (f == -1 && isopen) {
/* If out of fd's close the old one and try again. */
if (errno == ENFILE || errno == EMFILE) {
(void) (*fp->_close)(fp->_cookie);
@@ -121,7 +121,7 @@ freopen(const char *file, const char *mode, FILE *fp)
FREELB(fp);
fp->_lb._size = 0;
- if (f < 0) { /* did not get it after all */
+ if (f == -1) { /* did not get it after all */
fp->_flags = 0; /* set it free */
FUNLOCKFILE(fp);
errno = sverrno; /* restore in case _close clobbered */