[network-manager-vpnc/dcbw/need-secrets: 9/10] fixup! core: parse vpnc stdin/stdout and request secrets asynchronously



commit 3de255decb297fb6eb823fcb6b1bc17844c3e2be
Author: Dan Williams <dcbw redhat com>
Date:   Fri Sep 26 17:00:07 2014 -0500

    fixup! core: parse vpnc stdin/stdout and request secrets asynchronously

 src/nm-vpnc-service.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/src/nm-vpnc-service.c b/src/nm-vpnc-service.c
index c0e16db..8fc6e50 100644
--- a/src/nm-vpnc-service.c
+++ b/src/nm-vpnc-service.c
@@ -492,15 +492,10 @@ data_available (GIOChannel *source,
        NMVPNCPlugin *plugin = NM_VPNC_PLUGIN (data);
        NMVPNCPluginPrivate *priv = NM_VPNC_PLUGIN_GET_PRIVATE (plugin);
        GError *error = NULL;
-       Pipe *pipe;
+       Pipe *pipe = NULL;
        gsize bytes_read = 0;
        GIOStatus status;
 
-       if (condition & G_IO_ERR) {
-               g_warning ("Unexpected vpnc pipe error");
-               return TRUE;
-       }
-
        /* Figure out which pipe we're using */
        if (source == priv->out.channel)
                pipe = &priv->out;
@@ -509,6 +504,11 @@ data_available (GIOChannel *source,
        else
                g_assert_not_reached ();
 
+       if (condition & G_IO_ERR) {
+               g_warning ("Unexpected vpnc pipe error");
+               goto fail;
+       }
+
        do {
                gsize consumed = 0;
                char buf[512];
@@ -543,9 +543,16 @@ data_available (GIOChannel *source,
                                }
                        } while (consumed);
                }
+
+               if (status == G_IO_STATUS_EOF)
+                       goto fail;
        } while (bytes_read);
 
        return TRUE;
+
+fail:
+       pipe->watch = 0;
+       return FALSE;
 }
 
 static void


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