From 7842f6e8b0966696b1b11462dd46eb245c813bd4 Mon Sep 17 00:00:00 2001 From: Artur Grabowski Date: Thu, 12 Oct 2000 10:51:14 +0000 Subject: Compare the return from mmap with MAP_FAILED, do not cast to int and comapre with -1. --- bin/ksh/history.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'bin/ksh/history.c') diff --git a/bin/ksh/history.c b/bin/ksh/history.c index 1f02e938697..a423a8db397 100644 --- a/bin/ksh/history.c +++ b/bin/ksh/history.c @@ -1,4 +1,4 @@ -/* $OpenBSD: history.c,v 1.11 1999/06/15 01:18:34 millert Exp $ */ +/* $OpenBSD: history.c,v 1.12 2000/10/12 10:51:13 art Exp $ */ /* * command history @@ -862,7 +862,7 @@ hist_init(s) /* * check on its validity */ - if ((int)base == -1 || *base != HMAGIC1 || base[1] != HMAGIC2) { + if (base == MAP_FAILED || *base != HMAGIC1 || base[1] != HMAGIC2) { if ((int)base != -1) munmap((caddr_t)base, hsize); hist_finish(); @@ -1109,7 +1109,7 @@ writehistfile(lno, cmd) /* someone has added some lines */ bytes = sizenow - hsize; base = (unsigned char *)mmap(0, sizenow, PROT_READ, MAP_FLAGS, histfd, 0); - if ((int)base == -1) + if (base == MAP_FAILED) goto bad; new = base + hsize; if (*new != COMMAND) { -- cgit v1.2.3