I don’t feel confident about assuming that a short read for a file means
EOF in all situations. For instance, it looks like short reads can
happen of an NFS file system mounted with the “intr” option, and it can
also happen if a file entry actually is a named pipe.
}
bool
-hash_fd(struct hash* hash, int fd, bool fd_is_file)
+hash_fd(struct hash* hash, int fd)
{
char buf[READ_BUFFER_SIZE];
ssize_t n;
if (n > 0) {
do_hash_buffer(hash, buf, n);
do_debug_text(hash, buf, n);
- if (fd_is_file && static_cast<size_t>(n) < sizeof(buf)) {
- break;
- }
}
}
return n >= 0;
return false;
}
- bool ret = hash_fd(hash, *fd, true);
+ bool ret = hash_fd(hash, *fd);
return ret;
}
// file.
//
// Returns true on success, otherwise false.
-bool hash_fd(struct hash* hash, int fd, bool fd_is_file = false);
+bool hash_fd(struct hash* hash, int fd);
// Add contents of a file to the hash.
//