From: Rich Felker Date: Tue, 25 Jun 2019 21:47:12 +0000 (-0400) Subject: allow fmemopen with zero size X-Git-Tag: v1.1.23~29 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=95dfa3dd12108f42b23a1083e7b32266246a3590;p=oweals%2Fmusl.git 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. --- 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; }