summaryrefslogtreecommitdiff
path: root/gnome-base/gdm/files/gdm-3.7.90-fix-daemonize-regression.patch
diff options
context:
space:
mode:
authorBlackNoxis <steven.darklight@gmail.com>2014-02-15 23:46:38 +0200
committerBlackNoxis <steven.darklight@gmail.com>2014-02-15 23:46:38 +0200
commit539ab2c329ef87cb855c5965a4e3995af9b1cad3 (patch)
treeeb48abd2bb1152d7a5a6e8e048d20f76b0057c9e /gnome-base/gdm/files/gdm-3.7.90-fix-daemonize-regression.patch
parentbf9f773fb3fcefed199cd8af38b65f77b347c80c (diff)
Added gnome already splitted ebuilds. will split later if needed to improve deps heaven
Diffstat (limited to 'gnome-base/gdm/files/gdm-3.7.90-fix-daemonize-regression.patch')
-rwxr-xr-xgnome-base/gdm/files/gdm-3.7.90-fix-daemonize-regression.patch134
1 files changed, 134 insertions, 0 deletions
diff --git a/gnome-base/gdm/files/gdm-3.7.90-fix-daemonize-regression.patch b/gnome-base/gdm/files/gdm-3.7.90-fix-daemonize-regression.patch
new file mode 100755
index 00000000..810bd6e8
--- /dev/null
+++ b/gnome-base/gdm/files/gdm-3.7.90-fix-daemonize-regression.patch
@@ -0,0 +1,134 @@
+From bda248c1e184f92aedf9f8d932ebd20746910d52 Mon Sep 17 00:00:00 2001
+From: Sobhan Mohammadpour <sobhanmohammadpour1@yahoo.fr>
+Date: Mon, 4 Mar 2013 21:23:45 +0330
+Subject: [PATCH] gdm-3.7.90 fix daemonize regression
+
+---
+ configure.ac | 4 ++++
+ daemon/Makefile.am | 1 +
+ daemon/main.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 50 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index 0918060..d4ea271 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -99,6 +99,10 @@ PKG_CHECK_MODULES(DAEMON,
+ AC_SUBST(DAEMON_CFLAGS)
+ AC_SUBST(DAEMON_LIBS)
+
++PKG_CHECK_MODULES(LIBDAEMON, libdaemon)
++AC_SUBST(LIBDAEMON_CFLAGS)
++AC_SUBST(LIBDAEMON_LIBS)
++
+ GLIB_GSETTINGS
+
+ PKG_CHECK_MODULES(NSS,
+diff --git a/daemon/Makefile.am b/daemon/Makefile.am
+index ead9096..b810089 100644
+--- a/daemon/Makefile.am
++++ b/daemon/Makefile.am
+@@ -385,6 +385,7 @@ gdm_LDADD = \
+ $(top_builddir)/common/libgdmcommon.la \
+ $(XLIB_LIBS) \
+ $(DAEMON_LIBS) \
++ $(LIBDAEMON_LIBS) \
+ $(XDMCP_LIBS) \
+ $(LIBWRAP_LIBS) \
+ $(SYSTEMD_LIBS) \
+diff --git a/daemon/main.c b/daemon/main.c
+index 8176fe3..0151862 100644
+--- a/daemon/main.c
++++ b/daemon/main.c
+@@ -34,6 +34,8 @@
+ #include <locale.h>
+ #include <signal.h>
+
++#include <libdaemon/dfork.h>
++
+ #include <glib.h>
+ #include <glib/gi18n.h>
+ #include <glib/gstdio.h>
+@@ -329,8 +331,10 @@ main (int argc,
+ static gboolean do_timed_exit = FALSE;
+ static gboolean print_version = FALSE;
+ static gboolean fatal_warnings = FALSE;
++ static gboolean no_daemon = FALSE;
+ static GOptionEntry entries [] = {
+ { "fatal-warnings", 0, 0, G_OPTION_ARG_NONE, &fatal_warnings, N_("Make all warnings fatal"), NULL },
++ { "nodaemon", 0, 0, G_OPTION_ARG_NONE, &no_daemon, N_("Do not fork into the background"), NULL },
+ { "timed-exit", 0, 0, G_OPTION_ARG_NONE, &do_timed_exit, N_("Exit after a time (for debugging)"), NULL },
+ { "version", 0, 0, G_OPTION_ARG_NONE, &print_version, N_("Print GDM version"), NULL },
+
+@@ -343,6 +347,15 @@ main (int argc,
+
+ ret = 1;
+
++ /* preprocess the arguments to support the xdm style
++ * -nodaemon option
++ */
++ int i;
++ for ( i = 0; i < argc; i++) {
++ if (strcmp (argv[i], "-nodaemon") == 0)
++ argv[i] = "--nodaemon";
++ }
++
+ context = g_option_context_new (_("GNOME Display Manager"));
+ g_option_context_add_main_entries (context, entries, NULL);
+ g_option_context_set_ignore_unknown_options (context, TRUE);
+@@ -369,6 +382,33 @@ main (int argc,
+ g_log_set_always_fatal (fatal_mask);
+ }
+
++ if (!no_daemon) {
++ pid_t pid;
++ if (daemon_retval_init () < 0) {
++ g_warning ("Failed to create pipe");
++ exit (-1);
++ }
++ if ((pid = daemon_fork ()) < 0) {
++ /* Fork failed */
++ daemon_retval_done ();
++ exit (1);
++ } else if (pid) {
++ /* Parent process: wait 20s for daemon_retval_send() in the daemon process */
++ if ((ret = daemon_retval_wait (20)) < 0) {
++ g_warning ("Timed out waiting for daemon process: %s", strerror(errno));
++ exit (255);
++ } else if (ret > 0) {
++ g_warning ("Daemon process returned error code %d", ret);
++ exit (ret);
++ }
++ exit (0);
++ }
++ /* Daemon process */
++ daemon_close_all (-1);
++ /* Start a new process group so that killing the daemon will kill the processes that it spawned */
++ setsid ();
++ }
++
+ gdm_log_init ();
+
+ settings = gdm_settings_new ();
+@@ -418,6 +458,9 @@ main (int argc,
+ g_timeout_add_seconds (30, (GSourceFunc) timed_exit_cb, main_loop);
+ }
+
++ if (!no_daemon)
++ daemon_retval_send (0);
++
+ g_main_loop_run (main_loop);
+
+ g_debug ("GDM finished, cleaning up...");
+@@ -433,6 +476,8 @@ main (int argc,
+ ret = 0;
+
+ out:
++ if (!no_daemon)
++ daemon_retval_send (ret);
+ if (error) {
+ g_printerr ("%s\n", error->message);
+ g_clear_error (&error);
+--
+1.8.1.2
+