[network-manager-openswan] service: properly handle pty master hangups



commit 3caa64591364ae59284130a89c57e98f3b57eb9f
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Mon Oct 26 11:18:07 2015 +0100

    service: properly handle pty master hangups
    
    Missing hunks from [service: watch for pty master hangups] omitted by accident.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1271973#c5

 src/nm-openswan-service.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/nm-openswan-service.c b/src/nm-openswan-service.c
index 84037ef..9f459fe 100644
--- a/src/nm-openswan-service.c
+++ b/src/nm-openswan-service.c
@@ -339,7 +339,7 @@ pipe_init (Pipe *pipe, int fd, const char *detail)
        pipe->channel = g_io_channel_unix_new (fd);
        g_io_channel_set_encoding (pipe->channel, NULL, NULL);
        g_io_channel_set_buffered (pipe->channel, FALSE);
-       pipe->id = g_io_add_watch (pipe->channel, G_IO_IN | G_IO_ERR, pr_cb, pipe);
+       pipe->id = g_io_add_watch (pipe->channel, G_IO_IN | G_IO_ERR | G_IO_HUP, pr_cb, pipe);
 }
 
 static void
@@ -925,7 +925,13 @@ io_cb (GIOChannel *source, GIOCondition condition, gpointer user_data)
        NMVpnConnectionStateReason reason = NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED;
        const char *found;
 
-       if (condition & (G_IO_ERR | G_IO_HUP)) {
+       if (condition & G_IO_HUP) {
+               DEBUG ("PTY disconnected");
+               priv->io_id = 0;
+               return G_SOURCE_REMOVE;
+       }
+
+       if (condition & G_IO_ERR) {
                g_warning ("PTY spawn: pipe error!");
                goto done;
        }
@@ -996,7 +1002,7 @@ pr_cb (GIOChannel *source, GIOCondition condition, gpointer user_data)
        char *nl;
 
        if (condition & (G_IO_ERR | G_IO_HUP)) {
-               g_warning ("PTY(%s) pipe error!", pipe->detail);
+               DEBUG ("PTY(%s) pipe error!", pipe->detail);
                return G_SOURCE_REMOVE;
        }
        g_assert (condition & G_IO_IN);


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