Merge pull request #366 from duskCoder/patch-slurp
Fix propagation of read error from slurp.
This commit is contained in:
commit
807b72a8b1
@ -14,6 +14,9 @@
|
||||
/*
|
||||
* Reads size bytes into the destination buffer from filename.
|
||||
*
|
||||
* On success, true is returned. Otherwise, false is returned and the content
|
||||
* of destination is left untouched.
|
||||
*
|
||||
*/
|
||||
bool slurp(const char *filename, char *destination, int size) {
|
||||
int fd;
|
||||
@ -27,7 +30,7 @@ bool slurp(const char *filename, char *destination, int size) {
|
||||
destination[n] = '\0';
|
||||
(void)close(fd);
|
||||
|
||||
return true;
|
||||
return n != -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user