diff options
author | Thomas Haller <thaller@redhat.com> | 2016-03-22 11:00:54 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-03-23 09:08:35 +0100 |
commit | 4faaa3eb0b1dc8a749660850f10f8b9828858bf7 (patch) | |
tree | de36a62c521235fcc05647d472338e0fef950613 | |
parent | 3bcc0e5cea510746c14e80dae3da5e6f7e863706 (diff) | |
download | NetworkManager-4faaa3eb0b1dc8a749660850f10f8b9828858bf7.tar.gz |
dns: fix _NMLOG() macro
The buffer was too small to contain _NMLOG_PREFIX_NAME and the pointer,
resulting in truncated messages like:
dns-mgr[0x561d1183d: set resolv-conf-mode: none
-rw-r--r-- | src/dns-manager/nm-dns-manager.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/dns-manager/nm-dns-manager.c b/src/dns-manager/nm-dns-manager.c index 79d345bed3..610e4365c6 100644 --- a/src/dns-manager/nm-dns-manager.c +++ b/src/dns-manager/nm-dns-manager.c @@ -100,14 +100,11 @@ NM_DEFINE_SINGLETON_INSTANCE (NMDnsManager); const NMDnsManager *const __self = (self); \ \ _nm_log (__level, _NMLOG_DOMAIN, 0, \ - "%s: " _NM_UTILS_MACRO_FIRST (__VA_ARGS__), \ - ((__self == singleton_instance) \ - ? _NMLOG_PREFIX_NAME \ - : ({ \ - g_snprintf (__prefix, sizeof (__prefix), "%s[%p]", _NMLOG_PREFIX_NAME, __self); \ - __prefix; \ - }) \ - ) \ + "%s%s: " _NM_UTILS_MACRO_FIRST (__VA_ARGS__), \ + _NMLOG_PREFIX_NAME, \ + ((!__self || __self == singleton_instance) \ + ? "" \ + : nm_sprintf_buf (__prefix, "[%p]", __self)) \ _NM_UTILS_MACRO_REST (__VA_ARGS__)); \ } \ } G_STMT_END |