[bugfix] call setvbuf in pic_file constructor

This commit is contained in:
Yuichi Nishiwaki 2014-01-16 18:37:54 +09:00
parent 3d72464e80
commit 14b73501c4
1 changed files with 7 additions and 0 deletions

View File

@ -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;
}