summaryrefslogtreecommitdiff
path: root/usr.bin/grep/mmfile.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2019-01-27 14:43:10 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2019-01-27 14:43:10 +0000
commit5be114fe7c97713b4e08afaf797a28f12649242f (patch)
tree129725f6bca3b1fdb184de8a9118d8eba46adf6e /usr.bin/grep/mmfile.c
parenta40886e403c7f84a7d9706c9dadabb490469174f (diff)
mmap support was broken in previous submitted diff from lauri tirkkonen
Diffstat (limited to 'usr.bin/grep/mmfile.c')
-rw-r--r--usr.bin/grep/mmfile.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/grep/mmfile.c b/usr.bin/grep/mmfile.c
index fa5a0ea7752..62d089aaff4 100644
--- a/usr.bin/grep/mmfile.c
+++ b/usr.bin/grep/mmfile.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mmfile.c,v 1.18 2019/01/23 23:00:54 tedu Exp $ */
+/* $OpenBSD: mmfile.c,v 1.19 2019/01/27 14:43:09 deraadt Exp $ */
/*-
* Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
@@ -49,6 +49,7 @@ mmopen(int fd, struct stat *st)
if (st->st_size > SIZE_MAX) /* too big to mmap */
goto ouch;
mmf->len = (size_t)st->st_size;
+ mmf->fd = fd;
mmf->base = mmap(NULL, mmf->len, PROT_READ, MAP_PRIVATE, mmf->fd, (off_t)0);
if (mmf->base == MAP_FAILED)
goto ouch;