salto_simulator icon indicating copy to clipboard operation
salto_simulator copied to clipboard

src/drive.c uses fread(3) like it’s read(2)

Open eschaton opened this issue 9 years ago • 0 comments

The code in src/drive.c that calls fread(3) treats its return (a size_t) as if it were the return from read(2) (a ssize_t).

For fread(3) the return value will never be negative. Instead, any time the return value is less than the amount requested, you need to check for both failure and EOF using ferror(3) and feof(3) respectively.

eschaton avatar Jun 24 '16 17:06 eschaton