[network-manager-libreswan/th/vpn-plugin-debug-bgo766872: 21/22] service: always read stdout/stderr of ipsec command



commit 0842e81e7ad231e9b3a3a502c645afaf05d8ac8c
Author: Thomas Haller <thaller redhat com>
Date:   Mon May 30 19:22:04 2016 +0200

    service: always read stdout/stderr of ipsec command
    
    We redirect stdout/stderr of the ipsec command to a pipe.
    
    That is for one done soe that we can print it as our own
    logging output (and possibly disable it unless debug logging
    is enabled).
    
    It is also done, to make the command invocation silent, unless
    debug logging is enabled.
    Not redirecting unless debug logging is enabled is hence not an option,
    because then our regular output would be spammed with debugging information.
    
    However, as we create a pipe, we *must* read it and possible throw away
    the data. Otherwise, the pipe might fill up and block the process which
    wants to write to it.

 src/nm-libreswan-service.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/src/nm-libreswan-service.c b/src/nm-libreswan-service.c
index ab13627..c75dd6a 100644
--- a/src/nm-libreswan-service.c
+++ b/src/nm-libreswan-service.c
@@ -1664,10 +1664,8 @@ connect_step (NMLibreswanPlugin *self, GError **error)
                g_io_channel_set_buffered (priv->channel, FALSE);
                priv->io_id = g_io_add_watch (priv->channel, G_IO_IN | G_IO_ERR | G_IO_HUP, io_cb, self);
 
-               if (_LOGD_enabled ()) {
-                       pipe_init (&priv->out, up_stdout, "OUT");
-                       pipe_init (&priv->err, up_stderr, "ERR");
-               }
+               pipe_init (&priv->out, up_stdout, "OUT");
+               pipe_init (&priv->err, up_stderr, "ERR");
                return TRUE;
 
        case CONNECT_STEP_LAST:


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