summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/rcs/diff.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/usr.bin/rcs/diff.c b/usr.bin/rcs/diff.c
index 3dede6b45f2..260b2352882 100644
--- a/usr.bin/rcs/diff.c
+++ b/usr.bin/rcs/diff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.c,v 1.33 2011/04/20 19:34:16 nicm Exp $ */
+/* $OpenBSD: diff.c,v 1.34 2013/05/16 12:44:48 stsp Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
* All rights reserved.
@@ -1132,17 +1132,14 @@ static int
asciifile(FILE *f)
{
unsigned char buf[BUFSIZ];
- size_t i, cnt;
+ size_t cnt;
if (f == NULL)
return (1);
rewind(f);
cnt = fread(buf, 1, sizeof(buf), f);
- for (i = 0; i < cnt; i++)
- if (!isprint(buf[i]) && !isspace(buf[i]))
- return (0);
- return (1);
+ return (memchr(buf, '\0', cnt) == NULL);
}
#define begins_with(s, pre) (strncmp(s, pre, sizeof(pre)-1) == 0)