diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2000-10-12 10:51:14 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2000-10-12 10:51:14 +0000 |
commit | 7842f6e8b0966696b1b11462dd46eb245c813bd4 (patch) | |
tree | f1addd70d686863cf6bc706bce1a1e0d3944a29f /bin/ksh | |
parent | 11b0db882f528f1b50ac58b41a71f0809f3e21c8 (diff) |
Compare the return from mmap with MAP_FAILED, do not cast to int and comapre
with -1.
Diffstat (limited to 'bin/ksh')
-rw-r--r-- | bin/ksh/history.c | 6 |
1 files changed, 3 insertions, 3 deletions
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) { |