From 7f5724ad4c5a55d2595b4502c1a98622a659f50d Mon Sep 17 00:00:00 2001 From: fvdl Date: Thu, 7 Sep 2000 22:20:45 +0000 Subject: [PATCH] In the case of MAP_ANON, Linux mmap ignores the fd argument completely. So, always pass -1 to the native syscall in that case, to avoid errors if a Linux app doesn't specify -1 as the fd (which some do). --- sys/compat/linux/common/linux_misc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/compat/linux/common/linux_misc.c b/sys/compat/linux/common/linux_misc.c index 55254545bbfb..36f61e00ae9c 100644 --- a/sys/compat/linux/common/linux_misc.c +++ b/sys/compat/linux/common/linux_misc.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_misc.c,v 1.71 2000/06/29 02:40:39 mrg Exp $ */ +/* $NetBSD: linux_misc.c,v 1.72 2000/09/07 22:20:45 fvdl Exp $ */ /*- * Copyright (c) 1995, 1998, 1999 The NetBSD Foundation, Inc. @@ -412,7 +412,7 @@ linux_sys_mmap(p, v, retval) if (SCARG(&cma,prot) & VM_PROT_WRITE) /* XXX */ SCARG(&cma,prot) |= VM_PROT_READ; SCARG(&cma,flags) = flags; - SCARG(&cma,fd) = SCARG(uap, fd); + SCARG(&cma,fd) = flags & MAP_ANON ? -1 : SCARG(uap, fd); SCARG(&cma,pad) = 0; SCARG(&cma,pos) = SCARG(uap, offset);