mirror of
https://github.com/openbsd/src.git
synced 2025-01-10 06:47:55 -08:00
-1 -> MAP_FAILED
This commit is contained in:
parent
c18c18854b
commit
8a110bf69f
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: mem1.c,v 1.2 1996/06/26 05:44:17 deraadt Exp $ */
|
||||
/* $OpenBSD: mem1.c,v 1.3 2001/05/11 16:06:06 art Exp $ */
|
||||
/* $NetBSD: mem1.c,v 1.2 1995/07/03 21:24:25 cgd Exp $ */
|
||||
|
||||
/*
|
||||
@ -33,7 +33,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$OpenBSD: mem1.c,v 1.2 1996/06/26 05:44:17 deraadt Exp $";
|
||||
static char rcsid[] = "$OpenBSD: mem1.c,v 1.3 2001/05/11 16:06:06 art Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -181,7 +181,7 @@ xnewblk()
|
||||
prot = PROT_READ | PROT_WRITE;
|
||||
flags = MAP_ANON | MAP_PRIVATE;
|
||||
mb->blk = mmap(NULL, mblklen, prot, flags, -1, (off_t)0);
|
||||
if (mb->blk == (void *)-1)
|
||||
if (mb->blk == MAP_FAILED)
|
||||
err(1, "can't map memory");
|
||||
if (ALIGN((u_long)mb->blk) != (u_long)mb->blk)
|
||||
errx(1, "mapped address is not aligned");
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: mem2.c,v 1.2 1996/06/26 05:44:25 deraadt Exp $ */
|
||||
/* $OpenBSD: mem2.c,v 1.3 2001/05/11 16:06:57 art Exp $ */
|
||||
/* $NetBSD: mem2.c,v 1.3 1995/10/02 17:27:11 jpo Exp $ */
|
||||
|
||||
/*
|
||||
@ -33,7 +33,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$OpenBSD: mem2.c,v 1.2 1996/06/26 05:44:25 deraadt Exp $";
|
||||
static char rcsid[] = "$OpenBSD: mem2.c,v 1.3 2001/05/11 16:06:57 art Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -83,7 +83,7 @@ xalloc(sz)
|
||||
prot = PROT_READ | PROT_WRITE;
|
||||
flags = MAP_ANON | MAP_PRIVATE;
|
||||
mbuf = mmap(NULL, mblklen, prot, flags, -1, (off_t)0);
|
||||
if (mbuf == (void *)-1)
|
||||
if (mbuf == MAP_FAILED)
|
||||
err(1, "can't map memory");
|
||||
if (ALIGN((u_long)mbuf) != (u_long)mbuf)
|
||||
errx(1, "mapped address is not aligned");
|
||||
|
@ -74,7 +74,7 @@ main(argc, argv)
|
||||
PROT_READ | PROT_WRITE,
|
||||
MAP_ANON | MAP_PRIVATE,
|
||||
-1, 0);
|
||||
if (rd.rd_addr == (caddr_t)-1) {
|
||||
if (rd.rd_addr == MAP_FAILED) {
|
||||
perror("mmap");
|
||||
exit(1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user