[network-manager-openvpn] service: fix endless loop in helper when run without debug level



commit 140070124a6b803f34062422717cf905c1e4828c
Author: Thomas Haller <thaller redhat com>
Date:   Wed May 25 09:29:26 2016 +0200

    service: fix endless loop in helper when run without debug level
    
    The logging macro _LOGD() evaluates the arguments lazily.
    It must have no side-effects.
    
    Fixes: 00b9dcc96b9be48433596f0040cd356b7696e5d5

 src/nm-openvpn-service-openvpn-helper.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/src/nm-openvpn-service-openvpn-helper.c b/src/nm-openvpn-service-openvpn-helper.c
index 9d5d444..669e6b6 100644
--- a/src/nm-openvpn-service-openvpn-helper.c
+++ b/src/nm-openvpn-service-openvpn-helper.c
@@ -522,9 +522,8 @@ main (int argc, char *argv[])
                _LOGD ("command line: %s", args->str);
                g_string_free (args, TRUE);
 
-               iter = environ;
-               while (iter && *iter)
-                       _LOGD ("environment: %s", *iter++);
+               for (iter = environ; iter && *iter; iter++)
+                       _LOGD ("environment: %s", *iter);
        }
 
        /* shift the arguments to the right leaving only those provided by openvpn */


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