From ad3bbda8e328663fc2fe954c8d1586b90be07f93 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 18 Dec 2017 14:49:11 +0100 Subject: [PATCH] core: avoid compiler warnings in write_to_netconfig() and ifnet_update_parsers_by_connection() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit src/dns/nm-dns-manager.c: In function ‘write_to_netconfig’: src/dns/nm-dns-manager.c:387:8: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result] write (fd, str, strlen (str)); ^ src/settings/plugins/ifnet/nms-ifnet-connection-parser.c: In function ‘ifnet_update_parsers_by_connection’: src/settings/plugins/ifnet/nms-ifnet-connection-parser.c:2600:26: error: variable ‘pppoe’ set but not used [-Werror=unused-but-set-variable] gboolean wired = FALSE, pppoe = TRUE; ^~~~~ While at it, don't log line breaks in ifnet_update_parsers_by_connection(). Fixes: e912b36d95a3c26a6021eeb27e663bd05910a9b4 --- src/dns/nm-dns-manager.c | 7 +++---- src/settings/plugins/ifnet/nms-ifnet-connection-parser.c | 3 +-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/dns/nm-dns-manager.c b/src/dns/nm-dns-manager.c index 84c6b57746..6d4000b637 100644 --- a/src/dns/nm-dns-manager.c +++ b/src/dns/nm-dns-manager.c @@ -380,12 +380,11 @@ run_netconfig (NMDnsManager *self, GError **error, gint *stdin_fd) static void write_to_netconfig (NMDnsManager *self, gint fd, const char *key, const char *value) { - char *str; + gs_free char *str = NULL; str = g_strdup_printf ("%s='%s'\n", key, value); - _LOGD ("writing to netconfig: %s", str); - write (fd, str, strlen (str)); - g_free (str); + _LOGD ("writing to netconfig: %s='%s'", key, value); + (void) write (fd, str, strlen (str)); } static SpawnResult diff --git a/src/settings/plugins/ifnet/nms-ifnet-connection-parser.c b/src/settings/plugins/ifnet/nms-ifnet-connection-parser.c index ed0a757fdb..ee3092d6c3 100644 --- a/src/settings/plugins/ifnet/nms-ifnet-connection-parser.c +++ b/src/settings/plugins/ifnet/nms-ifnet-connection-parser.c @@ -2597,7 +2597,7 @@ ifnet_update_parsers_by_connection (NMConnection *connection, gboolean success = FALSE; const char *type; gboolean no_8021x = FALSE; - gboolean wired = FALSE, pppoe = TRUE; + gboolean wired = FALSE; const char *new_name = NULL; if (!ifnet_can_write_connection (connection, error)) @@ -2630,7 +2630,6 @@ ifnet_update_parsers_by_connection (NMConnection *connection, s_pppoe = nm_connection_get_setting_pppoe (connection); if (!write_pppoe_setting (conn_name, s_pppoe)) goto out; - pppoe = TRUE; wired = TRUE; no_8021x = TRUE; } else {