PERFORCE change 188689 for review

Edward Tomasz Napierala trasz at FreeBSD.org
Thu Feb 10 17:19:39 UTC 2011


http://p4web.freebsd.org/@@188689?ac=10

Change 188689 by trasz at trasz_victim on 2011/02/10 17:19:24

	Replace signal(3) with sigaction(3).

Affected files ...

.. //depot/projects/soc2009/trasz_limits/lib/libutil/login_class.c#8 edit

Differences ...

==== //depot/projects/soc2009/trasz_limits/lib/libutil/login_class.c#8 (text+ko) ====

@@ -40,6 +40,7 @@
 #include <login_cap.h>
 #include <paths.h>
 #include <pwd.h>
+#include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -425,7 +426,7 @@
     quad_t	p;
     mode_t	mymask;
     login_cap_t *llc = NULL;
-    sig_t	prevsig;
+    struct sigaction sa, prevsa;
     struct rtprio rtp;
     int error;
 
@@ -519,9 +520,12 @@
 	 * XXX: This is a workaround to fail gracefully in case the kernel
 	 *      does not support setloginclass(2).
 	 */
-	prevsig = signal(SIGSYS, SIG_IGN);
+	bzero(&sa, sizeof(sa));
+	sa.sa_handler = SIG_IGN;
+	sigfillset(&sa.sa_mask);
+	sigaction(SIGSYS, &sa, &prevsa);
 	error = setloginclass(lc->lc_class);
-	signal(SIGSYS, prevsig);
+	sigaction(SIGSYS, &prevsa, NULL);
         if (error != 0) {
 	    syslog(LOG_ERR, "setloginclass(%s): %m", lc->lc_class);
 #ifdef notyet


More information about the p4-projects mailing list