[gdm] daemon: set sigpipe to default value before starting session



commit 7c141ee0a69b23a31caa3f5df8c4f9b2a2bf442b
Author: Brian Cameron <Brian Cameron oracle com>
Date:   Mon Feb 7 11:31:18 2011 -0500

    daemon: set sigpipe to default value before starting session
    
    Some users have complained that because GDM sets SIGPIPE to ignore that
    this causes problems when running programs started in the user session.
    For example, if the user runs "cat file | head -10" the head command
    completes after processing 10 lines and sends a SIGPIPE to cat to inform
    it to exit.  However, when SIGPIPE is set to ignore, the CPU is wasted
    while cat completes.
    
    This commit fixes this issue and sets SIGPIPE to SIG_DFL
    before running the Xsession script.  Note this is done after fork() so
    it doesn't affect the gdm-session-worker process.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=630484

 daemon/gdm-session-worker.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c
index 648d6f7..3dd714f 100644
--- a/daemon/gdm-session-worker.c
+++ b/daemon/gdm-session-worker.c
@@ -2022,6 +2022,13 @@ gdm_session_worker_start_user_session (GdmSessionWorker  *worker,
 
                 _save_user_settings (worker, home_dir);
 
+                /*
+                 * Reset SIGPIPE to default so that any process in the user
+                 * session get the default SIGPIPE behavior instead of ignoring
+                 * SIGPIPE.
+                 */
+                signal (SIGPIPE, SIG_DFL);
+
                 gdm_session_execute (worker->priv->arguments[0],
                                      worker->priv->arguments,
                                      environment,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]