summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2003-09-09 05:04:28 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2003-09-09 05:04:28 +0000
commitb1ab043563195417ffd051e4c086c08c3fdc2fac (patch)
tree05a1cd374d50480d849585feee307c4423f79a82 /usr.bin
parent7bb4812543929f894a77babc9b136e088e666c51 (diff)
mmap returns MAP_FAILED on failure. fixes hugh@'s crash. ok deraadt@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/grep/mmfile.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/grep/mmfile.c b/usr.bin/grep/mmfile.c
index 436edd72c24..d0b82579080 100644
--- a/usr.bin/grep/mmfile.c
+++ b/usr.bin/grep/mmfile.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mmfile.c,v 1.6 2003/06/24 18:43:11 tedu Exp $ */
+/* $OpenBSD: mmfile.c,v 1.7 2003/09/09 05:04:27 tedu Exp $ */
/*-
* Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
@@ -60,7 +60,7 @@ mmopen(char *fn, char *mode)
goto ouch2;
mmf->len = (size_t)st.st_size;
mmf->base = mmap(NULL, mmf->len, PROT_READ, MAP_PRIVATE, mmf->fd, (off_t)0);
- if (mmf->base == NULL)
+ if (mmf->base == MAP_FAILED)
goto ouch2;
mmf->ptr = mmf->base;
mmf->end = mmf->base + mmf->len;