From 12f0744f340746b3a1c1accfdf993d6548f33e56 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 23 May 2017 17:35:49 -0700 Subject: Add and use xmmap. Everyone forgets that mmap returns MAP_FAILED rather than NULL on failure. Every use of mmap in toybox was either doing the wrong check, or no check at all (including the two I personally added). --- toys/other/hexedit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'toys/other/hexedit.c') diff --git a/toys/other/hexedit.c b/toys/other/hexedit.c index ffa304c3..3c5ada3a 100644 --- a/toys/other/hexedit.c +++ b/toys/other/hexedit.c @@ -140,7 +140,7 @@ void hexedit_main(void) for (pos = TT.len, TT.numlen = 0; pos; pos >>= 4, TT.numlen++); TT.numlen += (4-TT.numlen)&3; - TT.data = mmap(0, TT.len, PROT_READ|(PROT_WRITE*!ro), MAP_SHARED, fd, 0); + TT.data = xmmap(0, TT.len, PROT_READ|(PROT_WRITE*!ro), MAP_SHARED, fd, 0); draw_page(); for (;;) { -- cgit v1.2.3