diff options
author | Olivier Gayot <olivier.gayot@sigexec.com> | 2019-09-19 14:58:29 +0200 |
---|---|---|
committer | Olivier Gayot <olivier.gayot@sigexec.com> | 2019-09-19 15:47:14 +0200 |
commit | 4cf8bebf716cad62f75251370a5909a748dd744a (patch) | |
tree | 032780fda240a8bca0799473a4dbb988ab276e17 /include | |
parent | 5aec4a5da32e9a1fad1a89f17b10d676d4312895 (diff) |
Do not return true from slurp() if it failed to read
Failing to read() some data into the destination buffer from the slurp()
function was not considered an error. This means that we were
potentially leaving the caller with an uninitialized destination buffer
without letting him know it's uninitialized.
It is quite unlikely that a single call to read() would ever fail right
after a successful call to open(..., O_RDONLY). However, one practical
example of this happening is when the file being opened is actually a
directory.
Fixed by propagating the error (i.e. returning false from slurp()) if
the call to read() fails.
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions