Module Name:    src
Committed By:   reinoud
Date:           Fri Sep 16 22:07:17 UTC 2011

Modified Files:
        src/sys/kern: kern_sig.c

Log Message:
Fix sigactsunshare() to do what the manpage and the commit tells it to do!
I.e. unshare a process its sigacts by creating a new one BUT maintaining all
signal state.

The old code would CLEAR all the signal state. It used to work only due to the
fact that sigactunshare() is only used in execsigs() and the fact that
SIG_DFL was NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.315 -r1.316 src/sys/kern/kern_sig.c

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

Modified files:

Index: src/sys/kern/kern_sig.c
diff -u src/sys/kern/kern_sig.c:1.315 src/sys/kern/kern_sig.c:1.316
--- src/sys/kern/kern_sig.c:1.315	Sun Sep  4 23:03:00 2011
+++ src/sys/kern/kern_sig.c	Fri Sep 16 22:07:17 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_sig.c,v 1.315 2011/09/04 23:03:00 christos Exp $	*/
+/*	$NetBSD: kern_sig.c,v 1.316 2011/09/16 22:07:17 reinoud Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.315 2011/09/04 23:03:00 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.316 2011/09/16 22:07:17 reinoud Exp $");
 
 #include "opt_ptrace.h"
 #include "opt_compat_sunos.h"
@@ -296,7 +296,7 @@
 
 	ps = pool_cache_get(sigacts_cache, PR_WAITOK);
 	mutex_init(&ps->sa_mutex, MUTEX_DEFAULT, IPL_SCHED);
-	memset(ps->sa_sigdesc, 0, sizeof(ps->sa_sigdesc));
+	memcpy(ps->sa_sigdesc, oldps->sa_sigdesc, sizeof(ps->sa_sigdesc));
 	ps->sa_refcnt = 1;
 
 	p->p_sigacts = ps;

Reply via email to