diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-11-12 12:14:10 +0100 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-11-12 12:14:10 +0100 |
commit | db26e142d85621a5b79b1c1e44a909108637eaf7 (patch) | |
tree | 86a1033461b4ca7b5debe6e425adacd1f7835f5d /src | |
parent | cc071fd4def875ff7603dc8f3838306f6f4bd123 (diff) |
Check for st.st_size > 0
Diffstat (limited to 'src')
-rw-r--r-- | src/work.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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 |