correct locking in stdio functions that tried to be lock-free
[musl] / src / stdio / setvbuf.c
index 2985d3f..541a125 100644 (file)
@@ -9,14 +9,16 @@
  * In the case of stderr where the preexisting buffer is length 1, it
  * is not possible to set line buffering or full buffering. */
 
-int setvbuf(FILE *f, char *buf, int type, size_t size)
+int setvbuf(FILE *restrict f, char *restrict buf, int type, size_t size)
 {
        f->lbf = EOF;
 
        if (type == _IONBF)
-               f->buf_size = 1;
+               f->buf_size = 0;
        else if (type == _IOLBF)
                f->lbf = '\n';
 
+       f->flags |= F_SVB;
+
        return 0;
 }