POSIX signal handling in xfdesktop
Benedikt Meurer
Benedikt.Meurer at unix-ag.uni-siegen.de
Wed Feb 26 15:25:00 CET 2003
Hello,
The following patch makes xfdesktop use POSIX signal handling instead of
depreceated ANSI-C signal handling.
regrads,
Benedikt
--
Those who do not understand Unix are condemned to reinvent it, poorly.
-- Henry Spencer
-------------- next part --------------
--- ./src/main.c.orig Wed Feb 26 15:09:49 2003
+++ ./src/main.c Wed Feb 26 15:23:42 2003
@@ -275,6 +275,7 @@
int main(int argc, char **argv)
{
+ struct sigaction act;
Window xid;
TRACE();
@@ -286,10 +287,18 @@
/* g_message("xfdesktop: already running\n");*/
return 0;
}
-
- signal(SIGHUP, &sighandler);
- signal(SIGTERM, &sighandler);
- signal(SIGINT, &sighandler);
+
+ /* use POSIX signal handling */
+ act.sa_handler = sighandler;
+ sigemptyset(&act.sa_mask);
+#ifdef SA_RESTART
+ act.sa_flags = SA_RESTART;
+#else
+ act.sa_flags = 0;
+#endif
+ sigaction(SIGHUP, &act, NULL);
+ sigaction(SIGINT, &act, NULL);
+ sigaction(SIGTERM, &act, NULL);
client_session = client_session_new(argc, argv, NULL /* data */ ,
SESSION_RESTART_IF_RUNNING, 40);
More information about the Xfce4-dev
mailing list