Commit 8ee4db62 authored by Benoît Minisini's avatar Benoît Minisini
Browse files

Buffered streams read and write methods now correctly handle errors.

[INTERPRETER]
* BUG: Buffered streams read and write methods now correctly handle errors.
parent 0c0c658a
Pipeline #369951623 passed with stage
in 26 minutes
......@@ -111,7 +111,7 @@ static int stream_read(STREAM *stream, char *buffer, int len)
int eff;
if (!FD)
return TRUE;
return 0;
eff = (int)fread(buffer, 1, len, FD);
if (eff < len)
......@@ -135,10 +135,19 @@ static int stream_flush(STREAM *stream)
static int stream_write(STREAM *stream, char *buffer, int len)
{
int eff;
if (!FD)
return TRUE;
return 0;
return fwrite(buffer, 1, len, FD);
eff = (int)fwrite(buffer, 1, len, FD);
if (eff < len)
{
if (ferror(FD) == 0)
errno = 0;
}
return eff;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment