diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2006-09-19 05:52:24 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2006-09-19 05:52:24 +0000 |
commit | 2bcd7d59789e29c0979e4586e27c91231e0d98b0 (patch) | |
tree | 5dd2bc9696ae22a3cce9ac3a7b267336caf4f3a2 /usr.bin/grep/mmfile.c | |
parent | bec9fbb71b6b98020d52074619a34722765ce4ac (diff) |
Use S_IS* macros insted of masking with S_IF* flags. The latter may
have multiple bits set, which lead to surprising results. Spotted by
Paul Stoeber, more to come. ok millert@ pedro@ jaredy@ djm@
Diffstat (limited to 'usr.bin/grep/mmfile.c')
-rw-r--r-- | usr.bin/grep/mmfile.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/grep/mmfile.c b/usr.bin/grep/mmfile.c index c0996ade624..2c55d24b81c 100644 --- a/usr.bin/grep/mmfile.c +++ b/usr.bin/grep/mmfile.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mmfile.c,v 1.10 2006/02/09 09:54:47 otto Exp $ */ +/* $OpenBSD: mmfile.c,v 1.11 2006/09/19 05:52:23 otto Exp $ */ /*- * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav @@ -55,7 +55,7 @@ mmopen(char *fn, char *mode) goto ouch2; if (st.st_size > SIZE_T_MAX) /* too big to mmap */ goto ouch2; - if ((st.st_mode & S_IFREG) == 0) /* only mmap regular files */ + if (!S_ISDIR(st.st_mode)) /* only mmap regular files */ goto ouch2; mmf->len = (size_t)st.st_size; mmf->base = mmap(NULL, mmf->len, PROT_READ, MAP_PRIVATE, mmf->fd, (off_t)0); |