author | Rich Felker <dalias@aerifal.cx> | 2018年08月28日 19:16:40 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2018年08月28日 19:16:40 -0400 |
commit | f66022dda8d18e6732626c7806f6c4d32023d574 (patch) | |
tree | 8eefb9fe10f74c6e0e1406aceceaa636ca9c68cb /src/stdio/fmemopen.c | |
parent | b39b47bac8ee5505cfc595000a140c35460e1cac (diff) | |
download | musl-f66022dda8d18e6732626c7806f6c4d32023d574.tar.gz |
-rw-r--r-- | src/stdio/fmemopen.c | 1 |
diff --git a/src/stdio/fmemopen.c b/src/stdio/fmemopen.c index fb2656e3..5e0eeb50 100644 --- a/src/stdio/fmemopen.c +++ b/src/stdio/fmemopen.c @@ -112,6 +112,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; |