X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstdio%2Ffmemopen.c;h=82413b2d8d8386ab17b46fc49c68820551dd5deb;hb=7b384c42b73ca1a1e150b3f255990ec53cedec60;hp=fb2656e3ad19d16d623b9be3f1e5b49a1ef2533b;hpb=0b043c7b70b204c43dc7dbdb50b12aa8fa7981e8;p=musl diff --git a/src/stdio/fmemopen.c b/src/stdio/fmemopen.c index fb2656e3..82413b2d 100644 --- a/src/stdio/fmemopen.c +++ b/src/stdio/fmemopen.c @@ -1,7 +1,9 @@ #include "stdio_impl.h" #include #include +#include #include +#include "libc.h" struct cookie { size_t pos, len, size; @@ -112,6 +114,7 @@ FILE *fmemopen(void *restrict buf, size_t size, const char *restrict mode) if (!plus) f->f.flags = (*mode == 'r') ? F_NOWR : F_NORD; if (*mode == 'r') f->c.len = size; else if (*mode == 'a') f->c.len = f->c.pos = strnlen(buf, size); + else if (plus) *f->c.buf = 0; f->f.read = mread; f->f.write = mwrite;