From 14b73501c48d132fb918e1bb71b32044e003b554 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Thu, 16 Jan 2014 18:37:54 +0900 Subject: [PATCH] [bugfix] call setvbuf in pic_file constructor --- src/port.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/port.c b/src/port.c index e569ca3d..ebcd6dbb 100644 --- a/src/port.c +++ b/src/port.c @@ -82,12 +82,19 @@ pic_funopen(void *cookie, if (! file) { return NULL; } + /* no buffering at the beginning */ + file->buf = NULL; + file->mode = _IONBF; + file->bufsiz = 0; + /* set vtable */ file->vtable.cookie = cookie; file->vtable.read = read; file->vtable.write = write; file->vtable.seek = seek; file->vtable.close = close; + pic_setvbuf(file, (char *)NULL, _IOFBF, 0); + return file; }