projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update ctype data to unicode 12.1.0
[musl]
/
src
/
stdio
/
setvbuf.c
diff --git
a/src/stdio/setvbuf.c
b/src/stdio/setvbuf.c
index
b6b9b01
..
523dddc
100644
(file)
--- a/
src/stdio/setvbuf.c
+++ b/
src/stdio/setvbuf.c
@@
-12,13
+12,15
@@
int setvbuf(FILE *restrict f, char *restrict buf, int type, size_t size)
if (type == _IONBF) {
f->buf_size = 0;
if (type == _IONBF) {
f->buf_size = 0;
- } else {
+ } else
if (type == _IOLBF || type == _IOFBF)
{
if (buf && size >= UNGET) {
if (buf && size >= UNGET) {
- f->buf = (void *)
buf
;
+ f->buf = (void *)
(buf + UNGET)
;
f->buf_size = size - UNGET;
}
if (type == _IOLBF && f->buf_size)
f->lbf = '\n';
f->buf_size = size - UNGET;
}
if (type == _IOLBF && f->buf_size)
f->lbf = '\n';
+ } else {
+ return -1;
}
f->flags |= F_SVB;
}
f->flags |= F_SVB;