diff options
author | Shea Levy <shea@shealevy.com> | 2016-07-11 15:44:44 -0400 |
---|---|---|
committer | Shea Levy <shea@shealevy.com> | 2016-07-11 15:44:44 -0400 |
commit | cb5e7254b66a06b78a5659551a6f28fc67e52267 (patch) | |
tree | e367ff5e386fc16247034da60cf30aff61ebaea4 /src/libutil/hash.cc | |
parent | 8a41792d431d6578836fde04d1742dbba878f979 (diff) |
Modernize AutoCloseFD
Diffstat (limited to 'src/libutil/hash.cc')
-rw-r--r-- | src/libutil/hash.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libutil/hash.cc b/src/libutil/hash.cc index 69ea95852..fa4258777 100644 --- a/src/libutil/hash.cc +++ b/src/libutil/hash.cc @@ -255,11 +255,11 @@ Hash hashFile(HashType ht, const Path & path) start(ht, ctx); AutoCloseFD fd = open(path.c_str(), O_RDONLY | O_CLOEXEC); - if (fd == -1) throw SysError(format("opening file ‘%1%’") % path); + if (!fd) throw SysError(format("opening file ‘%1%’") % path); unsigned char buf[8192]; ssize_t n; - while ((n = read(fd, buf, sizeof(buf)))) { + while ((n = read(fd.get(), buf, sizeof(buf)))) { checkInterrupt(); if (n == -1) throw SysError(format("reading file ‘%1%’") % path); update(ht, ctx, buf, n); |