Merge pull request #366 from duskCoder/patch-slurp

Fix propagation of read error from slurp.
This commit is contained in:
Michael Stapelberg 2019-09-19 16:07:59 +02:00 committed by GitHub
commit 807b72a8b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}
/*