aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/work.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/work.c b/src/work.c
index feb7c96..32962ff 100644
--- a/src/work.c
+++ b/src/work.c
@@ -92,7 +92,11 @@ process_file(const char *locl_filename, unsigned char **locl_buf)
goto err;
}
- if (S_ISREG(st.st_mode)) {
+ /* We need to assert for st.st_size > 0 as some files (such as various files
+ under /proc on Linux) are generated ‘on the fly’ and will report a
+ filesize of 0. Despite being regular files, these files need to be
+ treated as if they are special. */
+ if (S_ISREG(st.st_mode) && st.st_size > 0) {
#if __linux__
(void)readahead(fd, 0, st.st_size);
#endif