summaryrefslogtreecommitdiffstats
path: root/newlib/libc/stdio
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdio')
-rw-r--r--newlib/libc/stdio/fmemopen.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/newlib/libc/stdio/fmemopen.c b/newlib/libc/stdio/fmemopen.c
index 4458d2176..5218e8a98 100644
--- a/newlib/libc/stdio/fmemopen.c
+++ b/newlib/libc/stdio/fmemopen.c
@@ -281,7 +281,7 @@ _DEFUN(_fmemopen_r, (ptr, buf, size, mode),
if ((flags = __sflags (ptr, mode, &dummy)) == 0)
return NULL;
- if (!size || !(buf || flags & __SAPP))
+ if (!size || !(buf || flags & __SRW))
{
ptr->_errno = EINVAL;
return NULL;
@@ -310,7 +310,7 @@ _DEFUN(_fmemopen_r, (ptr, buf, size, mode),
{
/* r+/w+/a+, and no buf: file starts empty. */
c->buf = (char *) (c + 1);
- *(char *) buf = '\0';
+ c->buf[0] = '\0';
c->pos = c->eof = 0;
c->append = (flags & __SAPP) != 0;
}