diff options
author | Michael Stapelberg <stapelberg@users.noreply.github.com> | 2019-09-19 16:07:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-19 16:07:59 +0200 |
commit | 807b72a8b1b8a4f092a5683fb00586755ee3944e (patch) | |
tree | 6da767c8658b652c4177af87d41574d0ae72c634 /src/general.c | |
parent | 5aec4a5da32e9a1fad1a89f17b10d676d4312895 (diff) | |
parent | 49cf3d7edb0b53f83ffd9c137901a05446cfcad4 (diff) |
Merge pull request #366 from duskCoder/patch-slurp
Fix propagation of read error from slurp.
Diffstat (limited to 'src/general.c')
-rw-r--r-- | src/general.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/general.c b/src/general.c index 1b11bd8..e3d4f96 100644 --- a/src/general.c +++ b/src/general.c @@ -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; } /* |