summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2024-01-31 13:40:55 -0500
committerJakob Kaivo <jkk@ung.org>2024-01-31 13:40:55 -0500
commit6c00bc2ee83be5c166ddc02259d33435d78da0cc (patch)
tree04dffc97c53ab92b8d86ecfe8886c92a46d18ff3
parent4b43b375b7abae22070cd86bfc26a8222233150e (diff)
filename is allowed to be NULL
-rw-r--r--src/stdio/freopen.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/stdio/freopen.c b/src/stdio/freopen.c
index d361023a..050e556b 100644
--- a/src/stdio/freopen.c
+++ b/src/stdio/freopen.c
@@ -55,8 +55,10 @@ FILE * freopen(const char * restrict filename, const char * restrict mode, FILE
int fd = -1;
SIGNAL_SAFE(0);
- ASSERT_NOOVERLAP(filename, strlen(filename), mode, strlen(mode));
- ASSERT_NOOVERLAP(filename, strlen(filename), stream, sizeof(*stream));
+ if (filename) {
+ ASSERT_NOOVERLAP(filename, strlen(filename), mode, strlen(mode));
+ ASSERT_NOOVERLAP(filename, strlen(filename), stream, sizeof(*stream));
+ }
ASSERT_NOOVERLAP(mode, strlen(mode), stream, sizeof(*stream));
for (i = 0; i < sizeof(modemap) / sizeof(modemap[0]); i++) {