aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-11-12 12:14:10 +0100
committerThomas Voss <mail@thomasvoss.com> 2024-11-12 12:14:10 +0100
commitdb26e142d85621a5b79b1c1e44a909108637eaf7 (patch)
tree86a1033461b4ca7b5debe6e425adacd1f7835f5d /src
parentcc071fd4def875ff7603dc8f3838306f6f4bd123 (diff)
Check for st.st_size > 0
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