Module Name:    src
Committed By:   christos
Date:           Wed Dec 22 22:19:46 UTC 2010

Modified Files:
        src/lib/libpthread: pthread.c

Log Message:
only mprotect base if we moved it.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/lib/libpthread/pthread.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libpthread/pthread.c
diff -u src/lib/libpthread/pthread.c:1.118 src/lib/libpthread/pthread.c:1.119
--- src/lib/libpthread/pthread.c:1.118	Sat Dec 18 10:54:27 2010
+++ src/lib/libpthread/pthread.c	Wed Dec 22 17:19:46 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.c,v 1.118 2010/12/18 15:54:27 christos Exp $	*/
+/*	$NetBSD: pthread.c,v 1.119 2010/12/22 22:19:46 christos Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread.c,v 1.118 2010/12/18 15:54:27 christos Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.119 2010/12/22 22:19:46 christos Exp $");
 
 #define	__EXPOSE_STACK	1
 
@@ -1227,10 +1227,10 @@
 		pthread__mainbase = (vaddr_t)base;
 		base = STACK_GROW(base, pthread__stacksize);
 		pthread__mainstruct = (vaddr_t)base;
+		if (mprotect(base, size, PROT_READ|PROT_WRITE) == -1)
+			err(1, "mprotect stack");
 	}
 	size = pthread__stacksize;
-	if (mprotect(base, size, PROT_READ|PROT_WRITE) == -1)
-		err(1, "mprotect stack");
 
 	error = pthread__stackid_setup(base, size, &t);
 	if (error) {

Reply via email to