errno is only valid after an error, and was being filled with a garbage
value upon eof.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/* If zero bytes were read, then we assume it's the end of the
* config file.
*/
- if ( bytes <= 0 ) {
+ if (bytes == 0)
+ break;
+ if ( bytes < 0 ) {
err = errno;
break;
}
/* If zero bytes were written, then we assume it's the end of the
* config file.
*/
- if ( bytes <= 0 ) {
+ if ( bytes == 0 )
+ break;
+ if ( bytes < 0 ) {
err = errno;
break;
}