diff options
author | 2005-04-25 08:21:20 +0000 | |
---|---|---|
committer | 2005-04-25 08:21:20 +0000 | |
commit | 6e7a98c82a7745a9ac34ead53ca986e8767678d6 (patch) | |
tree | 4af1b0061d4ecd7525d415d82948b7f810351d25 | |
parent | Do not define 'pl' globally. From Bjorn Sandell" <biorn at dce dot chalmers (diff) | |
download | wireguard-openbsd-6e7a98c82a7745a9ac34ead53ca986e8767678d6.tar.xz wireguard-openbsd-6e7a98c82a7745a9ac34ead53ca986e8767678d6.zip |
- use size_t where appropriate.
- check for <= 0 in gzread; it returns -1 on error.
From christos@netbsd; ok millert@
-rw-r--r-- | usr.bin/grep/binary.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/grep/binary.c b/usr.bin/grep/binary.c index fcc15419a02..80ecc798aff 100644 --- a/usr.bin/grep/binary.c +++ b/usr.bin/grep/binary.c @@ -1,4 +1,4 @@ -/* $OpenBSD: binary.c,v 1.14 2005/02/07 08:47:18 otto Exp $ */ +/* $OpenBSD: binary.c,v 1.15 2005/04/25 08:21:20 otto Exp $ */ /*- * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav @@ -39,13 +39,13 @@ int bin_file(FILE *f) { char buf[BUFSIZ]; - int i, m; + size_t i, m; int ret = 0; if (fseek(f, 0L, SEEK_SET) == -1) return 0; - if ((m = (int)fread(buf, 1, BUFSIZ, f)) == 0) + if ((m = fread(buf, 1, BUFSIZ, f)) == 0) return 0; for (i = 0; i < m; i++) @@ -69,7 +69,7 @@ gzbin_file(gzFile *f) if (gzseek(f, (z_off_t)0, SEEK_SET) == -1) return 0; - if ((m = gzread(f, buf, BUFSIZ)) == 0) + if ((m = gzread(f, buf, BUFSIZ)) <= 0) return 0; for (i = 0; i < m; i++) |