projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f368d9f
)
setvbuf: return failure if mode is invalid
author
A. Wilcox
<AWilcox@Wilcox-Tech.com>
Tue, 12 Mar 2019 20:31:22 +0000
(15:31 -0500)
committer
Rich Felker
<dalias@aerifal.cx>
Tue, 12 Mar 2019 20:44:41 +0000
(16:44 -0400)
POSIX requires setvbuf to return non-zero if `mode` is not one of _IONBF,
_IOLBF, or _IOFBF.
src/stdio/setvbuf.c
patch
|
blob
|
history
diff --git
a/src/stdio/setvbuf.c
b/src/stdio/setvbuf.c
index 06ea296c6a64202ed4f95e23c6af884f5305e1e7..523dddc8ba28f53a7b3fcc4e3e5323de092acc22 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;
- } else {
+ } else
if (type == _IOLBF || type == _IOFBF)
{
if (buf && size >= UNGET) {
f->buf = (void *)(buf + UNGET);
f->buf_size = size - UNGET;
}
if (type == _IOLBF && f->buf_size)
f->lbf = '\n';
+ } else {
+ return -1;
}
f->flags |= F_SVB;