Module Name:    src
Committed By:   kre
Date:           Sat Oct  7 17:15:44 UTC 2017

Modified Files:
        src/tests/lib/libc/sys: t_msgctl.c

Log Message:
If we have SYSVMSG in kernel (test finds it) restore the signal handler
to its previous state, so any signals that occur during the rest of the
test gat handled just as they would (core dump) as if the handler was never
executed.   No need to bother if the SYSVMSG test fails, as in that case,
nothing else will be done anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libc/sys/t_msgctl.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_msgctl.c
diff -u src/tests/lib/libc/sys/t_msgctl.c:1.6 src/tests/lib/libc/sys/t_msgctl.c:1.7
--- src/tests/lib/libc/sys/t_msgctl.c:1.6	Fri Oct  6 17:00:28 2017
+++ src/tests/lib/libc/sys/t_msgctl.c	Sat Oct  7 17:15:44 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: t_msgctl.c,v 1.6 2017/10/06 17:00:28 kre Exp $ */
+/* $NetBSD: t_msgctl.c,v 1.7 2017/10/07 17:15:44 kre Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_msgctl.c,v 1.6 2017/10/06 17:00:28 kre Exp $");
+__RCSID("$NetBSD: t_msgctl.c,v 1.7 2017/10/07 17:15:44 kre Exp $");
 
 #include <sys/msg.h>
 #include <sys/stat.h>
@@ -360,14 +360,16 @@ static int
 no_kernel_sysvmsg(void)
 {
 	int id;
+	void (*osig)(int);
 
 	sig_caught = 0;
-	(void) signal(SIGSYS, sigsys_handler);
+	osig = signal(SIGSYS, sigsys_handler);
 	id = msgget(MSG_KEY, IPC_CREAT | 0600);
 	if (sig_caught || id == -1)
 		return 1;
 
 	(void)msgctl(id, IPC_RMID, 0);
+	(void)signal(SIGSYS, osig);
 
 	return 0;
 }

Reply via email to