From 288256939248c6c8f9160f20992b7d70720a989d Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Tue, 18 Aug 2020 16:12:54 -0400 Subject: handle failure of open() when making syscall directly --- src/stdio/freopen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stdio/freopen.c b/src/stdio/freopen.c index 0afec064..bb3fe198 100644 --- a/src/stdio/freopen.c +++ b/src/stdio/freopen.c @@ -70,7 +70,7 @@ FILE * freopen(const char * restrict filename, const char * restrict mode, FILE if (filename != NULL) { fd = open(filename, openmode, 0); - if (fd == -1) { + if (fd < 0) { /* open() already sets errno */ funlockfile(stream); return NULL; -- cgit v1.2.1