Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.4
gnome-screensaver
gnome-screensaver-sigterm-handle.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File gnome-screensaver-sigterm-handle.patch of Package gnome-screensaver
diff --git a/src/gnome-screensaver-dialog.c b/src/gnome-screensaver-dialog.c index 72325e1..b269842 100644 --- a/src/gnome-screensaver-dialog.c +++ b/src/gnome-screensaver-dialog.c @@ -30,6 +30,7 @@ #include <sys/wait.h> #include <unistd.h> #include <signal.h> +#include <errno.h> #ifdef WITH_LIBFPRINT #include <pthread.h> @@ -550,13 +551,28 @@ popup_dialog_idle (void) return FALSE; } +static int sigterm_pipe_fds[2] = { -1, -1 }; + static void handle_sigterm (int sig) { + if (sigterm_pipe_fds[1] >= 0) { + if (write (sigterm_pipe_fds[1], "", 1) == -1) + g_printerr ("gnome-screensaver: write to sigterm_pipe failed.\n"); + close (sigterm_pipe_fds[1]); + sigterm_pipe_fds[1] = -1; + } +} + +static gboolean +on_sigterm () +{ if (xvkbd_running) kill (xvkbd_pid, 9); exit (0); + + return FALSE; } /* @@ -703,6 +719,7 @@ main (int argc, { GError *error = NULL; char *nolock_reason = NULL; + GIOChannel *channel; #ifdef ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); @@ -762,6 +779,16 @@ main (int argc, exit (1); } + if (pipe (sigterm_pipe_fds) != 0) + g_printerr ("Failed to create SIGTERM pipe: %s\n", + g_strerror (errno)); + + channel = g_io_channel_unix_new (sigterm_pipe_fds[0]); + g_io_channel_set_flags (channel, G_IO_FLAG_NONBLOCK, NULL); + g_io_add_watch (channel, G_IO_IN, (GIOFunc) on_sigterm, NULL); + g_io_channel_set_close_on_unref (channel, TRUE); + g_io_channel_unref (channel); + signal (SIGTERM, handle_sigterm); if (show_version) {
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor