[network-manager-fortisslvpn: 29/30] service: let pppd-plugin log via syslog()



commit 6ba3d1b58ebc12fce4c036529b4114bfd66e6208
Author: Thomas Haller <thaller redhat com>
Date:   Mon Sep 19 15:03:26 2016 +0200

    service: let pppd-plugin log via syslog()
    
    Printing to stdout is wrong, because openfortivpn intercepts
    that and parses it in the search of hdlc frames.
    Thus, the logging messages get lost and may even be wrongly
    interpreted by openfortivpn.
    
    Instead, use syslog for debug logging. pppd already calls openlog(),
    so we can just use syslog() right away.

 src/nm-fortisslvpn-pppd-plugin.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/src/nm-fortisslvpn-pppd-plugin.c b/src/nm-fortisslvpn-pppd-plugin.c
index 6abbb9d..001b270 100644
--- a/src/nm-fortisslvpn-pppd-plugin.c
+++ b/src/nm-fortisslvpn-pppd-plugin.c
@@ -59,11 +59,12 @@ static struct {
 #define _NMLOG(level, ...) \
     G_STMT_START { \
          if (gl.log_level >= (level)) { \
-             g_print ("nm-fortisslvpn[%s] %-7s [helper-%ld] " _NM_UTILS_MACRO_FIRST (__VA_ARGS__) "\n", \
-                      gl.log_prefix_token, \
-                      nm_utils_syslog_to_str (level), \
-                      (long) getpid () \
-                      _NM_UTILS_MACRO_REST (__VA_ARGS__)); \
+             syslog (nm_utils_syslog_coerce_from_nm (level), \
+                     "nm-fortisslvpn[%s] %-7s [helper-%ld] " _NM_UTILS_MACRO_FIRST (__VA_ARGS__) "\n", \
+                     gl.log_prefix_token, \
+                     nm_utils_syslog_to_str (level), \
+                     (long) getpid () \
+                     _NM_UTILS_MACRO_REST (__VA_ARGS__)); \
          } \
     } G_STMT_END
 


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