LibC: fflush file in setvbuf before updating the buffer
This commit is contained in:
parent
8e0d79f301
commit
8aff315c7b
|
@ -908,12 +908,16 @@ void setbuf(FILE* file, char* buffer)
|
|||
|
||||
int setvbuf(FILE* file, char* buffer, int type, size_t size)
|
||||
{
|
||||
ScopeLock _(file);
|
||||
|
||||
if (file->fd == -1)
|
||||
{
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
||||
(void)fflush(file);
|
||||
|
||||
if (size == 0)
|
||||
type = _IONBF;
|
||||
|
||||
|
|
Loading…
Reference in New Issue