From 95dfa3dd12108f42b23a1083e7b32266246a3590 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Tue, 25 Jun 2019 17:47:12 -0400 Subject: [PATCH] allow fmemopen with zero size previously, POSIX erroneously required this to fail with EINVAL despite the traditional glibc implementation, on which the POSIX interface was based, allowing it. the resolution of Austin Group issue 818 removes the requirement to fail. --- src/stdio/fmemopen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stdio/fmemopen.c b/src/stdio/fmemopen.c index 82413b2d..5685092e 100644 --- a/src/stdio/fmemopen.c +++ b/src/stdio/fmemopen.c @@ -83,7 +83,7 @@ FILE *fmemopen(void *restrict buf, size_t size, const char *restrict mode) struct mem_FILE *f; int plus = !!strchr(mode, '+'); - if (!size || !strchr("rwa", *mode)) { + if (!strchr("rwa", *mode)) { errno = EINVAL; return 0; } -- 2.25.1