aboutsummaryrefslogtreecommitdiff
path: root/bp.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2021-05-19 22:16:39 -0700
committerBruce Hill <bruce@bruce-hill.com>2021-05-19 22:16:39 -0700
commit3f0ab96f7f1c60585be7fa39d0595674bf4f6bb1 (patch)
treeec6b6c271c2295a4f407f012edbc2e7e639215c6 /bp.c
parentcd6b5925f109993d5c9c2afbbabb86c24791b17b (diff)
Fix for binary file detection bug.
Diffstat (limited to 'bp.c')
-rw-r--r--bp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bp.c b/bp.c
index b01c5b4..6eb9c3a 100644
--- a/bp.c
+++ b/bp.c
@@ -155,7 +155,8 @@ static int is_text_file(const char *filename)
(void)close(fd);
if (len < 0) return 0;
for (ssize_t i = 0; i < len; i++)
- if (!isprint(buf[i])) return 0;
+ if (isascii(buf[i]) && !(isprint(buf[i]) || isspace(buf[i])))
+ return 0;
return 1;
}