From 5be114fe7c97713b4e08afaf797a28f12649242f Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sun, 27 Jan 2019 14:43:10 +0000 Subject: mmap support was broken in previous submitted diff from lauri tirkkonen --- usr.bin/grep/mmfile.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'usr.bin/grep/mmfile.c') 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; -- cgit v1.2.3