about summary refs log tree commit diff
path: root/libio
diff options
context:
space:
mode:
Diffstat (limited to 'libio')
-rw-r--r--libio/fmemopen.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libio/fmemopen.c b/libio/fmemopen.c
index 23b5c5fea8..9264b724ee 100644
--- a/libio/fmemopen.c
+++ b/libio/fmemopen.c
@@ -86,10 +86,10 @@ fmemopen_write (void *cookie, const char *b, size_t s)
 
   memcpy (&(c->buffer[pos]), b, s);
 
-  pos += s;
-  if ((size_t) pos > c->maxpos)
+  c->pos += s;
+  if ((size_t) c->pos > c->maxpos)
     {
-      c->maxpos = pos;
+      c->maxpos = c->pos;
       if (addnullc)
 	c->buffer[c->maxpos] = '\0';
     }