Was not properly testing for error in fdport_write_substring's call to

fwrite().
This commit is contained in:
shivers 1997-04-08 20:07:30 +00:00
parent 18e8530076
commit 33e3bc8c62
1 changed files with 3 additions and 2 deletions

View File

@ -394,8 +394,9 @@ int read_fdport_substring(scheme_value buf, int start, int end, scheme_value dat
int write_fdport_substring(scheme_value buf, int start, int end, scheme_value data)
{
FILE *f = fstar_cache[EXTRACT_FIXNUM(*PortData_Fd(data))];
int retval = fwrite(StrByte(buf,start), 1, end-start, f);
return ferror(f) ? -1 : retval; /* -1: error, 0: eof */
int nbytes = end - start;
int retval = fwrite(StrByte(buf,start), 1, nbytes, f);
return (retval < nbytes) ? -1 : retval; /* -1: error, otw numwritten */
}
/* 1st return value says why we terminated the read: