From 46a7bfcb29ca7642cae080ca393cf145d15fb232 Mon Sep 17 00:00:00 2001 From: Seonah Moon Date: Mon, 10 Dec 2018 19:18:40 +0900 Subject: [PATCH] Fix dlog format error Change-Id: Ifa907a3cc5940157c05934bd0b92dfa58b51ee45 --- CMakeLists.txt | 2 +- gtest/netstat.cpp | 8 +++--- packaging/net-config.spec | 2 +- src/ip-conflict-detect.c | 16 +++++------ src/mptcp-internal.c | 2 +- src/network-monitor.c | 4 +-- src/signal-handler.c | 8 +++--- src/utils/util.c | 68 +++++++++++++++++++++++------------------------ src/wifi-agent.c | 16 +++++------ src/wifi-config.c | 2 +- src/wifi-eap-config.c | 4 +-- src/wifi-power.c | 9 +++---- 12 files changed, 70 insertions(+), 71 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f187136..550702a 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,7 +94,7 @@ ENDFOREACH(flag) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wall -Werror -fvisibility=hidden") SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} -Wall -Werror -fvisibility=hidden -fvisibility-inlines-hidden") -SET(CMAKE_C_FLAGS "-I${CMAKE_SOURCE_DIR} -I${CMAKE_SOURCE_DIR}/include ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE") +SET(CMAKE_C_FLAGS "-I${CMAKE_SOURCE_DIR} -I${CMAKE_SOURCE_DIR}/include ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE -D_GNU_SOURCE") SET(CMAKE_C_FLAGS_DEBUG "-O0 -g -fPIE") SET(CMAKE_C_FLAGS_RELEASE "-O2 -fPIE") diff --git a/gtest/netstat.cpp b/gtest/netstat.cpp index 01af513..02b8f20 100755 --- a/gtest/netstat.cpp +++ b/gtest/netstat.cpp @@ -54,7 +54,7 @@ error_e NetStat::GetWifiTotalTxBytes(void) g_variant_get(message, "(t)", &tx_bytes); g_variant_unref(message); - GLOGD("Succeeded to get wifi total tx bytes %d", tx_bytes); + GLOGD("Succeeded to get wifi total tx bytes %llu", tx_bytes); return ERROR_NONE; } @@ -80,7 +80,7 @@ error_e NetStat::GetWifiTotalRxBytes(void) g_variant_get(message, "(t)", &rx_bytes); g_variant_unref(message); - GLOGD("Succeeded to get wifi total rx bytes %d", rx_bytes); + GLOGD("Succeeded to get wifi total rx bytes %llu", rx_bytes); return ERROR_NONE; } @@ -106,7 +106,7 @@ error_e NetStat::GetWifiLastTxBytes(void) g_variant_get(message, "(t)", &tx_bytes); g_variant_unref(message); - GLOGD("Succeeded to get wifi last tx bytes %d", tx_bytes); + GLOGD("Succeeded to get wifi last tx bytes %llu", tx_bytes); return ERROR_NONE; } @@ -132,7 +132,7 @@ error_e NetStat::GetWifiLastRxBytes(void) g_variant_get(message, "(t)", &rx_bytes); g_variant_unref(message); - GLOGD("Succeeded to get wifi last rx bytes %d", rx_bytes); + GLOGD("Succeeded to get wifi last rx bytes %llu", rx_bytes); return ERROR_NONE; } diff --git a/packaging/net-config.spec b/packaging/net-config.spec index 716d7d5..6b69fdc 100755 --- a/packaging/net-config.spec +++ b/packaging/net-config.spec @@ -1,6 +1,6 @@ Name: net-config Summary: TIZEN Network Configuration service -Version: 1.1.137 +Version: 1.1.138 Release: 3 Group: System/Network License: Apache-2.0 diff --git a/src/ip-conflict-detect.c b/src/ip-conflict-detect.c index a2492e6..b941e5e 100755 --- a/src/ip-conflict-detect.c +++ b/src/ip-conflict-detect.c @@ -292,8 +292,8 @@ static gboolean send_arp(gpointer data) } if (ioctl(sd->chk_conflict_sd, SIOCGIFINDEX, &net_ifr) == -1) { - strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); - INFO("ioctl Failed. Error..... = %s\n", error_buf); + INFO("ioctl Failed. Error..... = %s\n", + strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER)); goto err; } @@ -306,8 +306,8 @@ static gboolean send_arp(gpointer data) memcpy(addr.sll_addr, broadcast_addr, ETHER_ADDR_LEN); if (sendto(sd->chk_conflict_sd, &arp, sizeof(arp), 0, (struct sockaddr*)&addr, sizeof(addr)) < 0) { - strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); - INFO("Sending ARP Packet Failed. Error. = %s\n", error_buf); + INFO("Sending ARP Packet Failed. Error. = %s\n", + strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER)); /* close socket */ if (-1 < sd->chk_conflict_sd) { close(sd->chk_conflict_sd); @@ -317,8 +317,8 @@ static gboolean send_arp(gpointer data) /* reopen socket */ if ((sd->chk_conflict_sd = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ARP))) == -1) { INFO("socket %d", sd->chk_conflict_sd); - strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); - INFO("socket Failed. Error = %s\n", error_buf); + INFO("socket Failed. Error = %s\n", + strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER)); } goto err; } else { @@ -365,8 +365,8 @@ struct sock_data * start_ip_conflict_mon(void) sd->iteration = 0; if ((sd->chk_conflict_sd = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ARP))) == -1) { - strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); - INFO("socket Failed. Error = %s\n", error_buf); + INFO("socket Failed. Error = %s\n", + strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER)); g_free(sd); return NULL; } else { diff --git a/src/mptcp-internal.c b/src/mptcp-internal.c index 69bdf7b..61ebbf1 100755 --- a/src/mptcp-internal.c +++ b/src/mptcp-internal.c @@ -95,7 +95,7 @@ gint mptcp_get_enabled() int enabled = -1; if ((buf = __read_mptcp_parameter(sysctlname)) == NULL) { - ERR("Fail to read %s, sysctlname"); + ERR("Fail to read %s", sysctlname); return -1; } diff --git a/src/network-monitor.c b/src/network-monitor.c index 21e6de7..4d9b85c 100755 --- a/src/network-monitor.c +++ b/src/network-monitor.c @@ -60,8 +60,8 @@ int netconfig_ethernet_cable_plugin_status_check() errno = 0; rv = fscanf(fd, "%d", &ret); if (rv < 0) { - strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); - ERR("Error! Failed to read from file, rv:[%d], error:[%s]", rv, error_buf); + ERR("Error! Failed to read from file, rv:[%d], error:[%s]", + rv, strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER)); fclose(fd); return -1; } diff --git a/src/signal-handler.c b/src/signal-handler.c index 8d7b66b..8dcef2c 100755 --- a/src/signal-handler.c +++ b/src/signal-handler.c @@ -220,8 +220,8 @@ static int __netconfig_handle_execute_file(const char *file_path, errno = 0; if (execve(file_path, args, envs) == -1) { - strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); - DBG("Fail to execute command (%s)", error_buf); + DBG("Fail to execute command (%s)", + strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER)); exit(1); } } else if (pid > 0) { @@ -242,8 +242,8 @@ static int __netconfig_handle_execute_file(const char *file_path, return rv; } - strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); - DBG("failed to fork(%s)", error_buf); + DBG("failed to fork(%s)", + strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER)); return -EIO; } diff --git a/src/utils/util.c b/src/utils/util.c index 27c2238..d80c743 100755 --- a/src/utils/util.c +++ b/src/utils/util.c @@ -428,8 +428,8 @@ int netconfig_execute_file(const char *file_path, errno = 0; if (execve(file_path, args, envs) == -1) { - strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); - DBG("Fail to execute command (%s)", error_buf); + DBG("Fail to execute command (%s)", + strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER)); exit(1); } } else if (pid > 0) { @@ -450,8 +450,8 @@ int netconfig_execute_file(const char *file_path, return rv; } - strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); - DBG("failed to fork(%s)", error_buf); + DBG("failed to fork(%s)", + strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER)); return -EIO; } @@ -476,8 +476,8 @@ int netconfig_execute_cmd(const char *cmd) errno = 0; if (execv(args[0], args) == -1) { - strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); - DBG("Fail to execute command (%s)", error_buf); + DBG("Fail to execute command (%s)", + strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER)); g_strfreev(args); exit(1); } @@ -500,8 +500,8 @@ int netconfig_execute_cmd(const char *cmd) return rv; } - strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); - DBG("failed to fork(%s)", error_buf); + DBG("failed to fork(%s)", + strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER)); g_strfreev(args); return -EIO; @@ -534,7 +534,7 @@ int netconfig_execute_clatd(const char *file_path, char *const args[]) state = sigaction(SIGCHLD, &act, 0); if (state != 0) { - DBG("sigaction() : %d"); + DBG("sigaction() : %d", state); return -1; } @@ -549,8 +549,8 @@ int netconfig_execute_clatd(const char *file_path, char *const args[]) errno = 0; if (execvp(file_path, args) == -1) { - strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); - ERR("Fail to execute command (%s)", error_buf); + ERR("Fail to execute command (%s)", + strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER)); return -1; } } else if (pid > 0) { @@ -558,8 +558,8 @@ int netconfig_execute_clatd(const char *file_path, char *const args[]) return rv; } - strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); - DBG("failed to fork(%s)", error_buf); + DBG("failed to fork(%s)", + strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER)); return -EIO; } @@ -590,7 +590,7 @@ int netconfig_execute_file_no_wait(const char *file_path, char *const args[]) state = sigaction(SIGCHLD, &act, 0); if (state != 0) { - DBG("sigaction() : %d"); + DBG("sigaction() : %d", state); return -1; } @@ -634,8 +634,8 @@ int __netconfig_get_interface_index(const char *interface_name) errno = 0; sock = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); if (sock < 0) { - strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); - DBG("Failed to create socket : %s", error_buf); + DBG("Failed to create socket : %s", + strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER)); return -1; } @@ -645,8 +645,8 @@ int __netconfig_get_interface_index(const char *interface_name) close(sock); if (result < 0) { - strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); - DBG("Failed to get ifr index: %s", error_buf); + DBG("Failed to get ifr index: %s", + strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER)); return -1; } @@ -694,14 +694,14 @@ int netconfig_add_route_ipv4(gchar *ip_addr, gchar *subnet, gchar *interface, gi sock = socket(PF_INET, SOCK_DGRAM, 0); if (sock < 0) { - strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); - DBG("Failed to create socket : %s", error_buf); + DBG("Failed to create socket : %s", + strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER)); return -1; } if (ioctl(sock, SIOCADDRT, &rt) < 0) { - strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); - DBG("Failed to set route address : %s", error_buf); + DBG("Failed to set route address : %s", + strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER)); close(sock); return -1; } @@ -745,14 +745,14 @@ int netconfig_del_route_ipv4(gchar *ip_addr, gchar *subnet, gchar *interface, gi sock = socket(PF_INET, SOCK_DGRAM, 0); if (sock < 0) { - strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); - DBG("Failed to create socket : %s", error_buf); + DBG("Failed to create socket : %s", + strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER)); return -1; } if (ioctl(sock, SIOCDELRT, &rt) < 0) { - strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); - DBG("Failed to set route address : %s", error_buf); + DBG("Failed to set route address : %s", + strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER)); close(sock); return -1; } @@ -777,16 +777,16 @@ int netconfig_add_route_ipv6(gchar *ip_addr, gchar *interface, gchar *gateway, u errno = 0; if (inet_pton(AF_INET6, ip_addr, &rt.rtmsg_dst) < 0) { - strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); - DBG("inet_pton failed : %s", error_buf); + DBG("inet_pton failed : %s", + strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER)); return -1; } if (gateway != NULL) { rt.rtmsg_flags |= RTF_GATEWAY; if (inet_pton(AF_INET6, gateway, &rt.rtmsg_gateway) < 0) { - strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); - DBG("inet_pton failed : %s", error_buf); + DBG("inet_pton failed : %s", + strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER)); return -1; } } @@ -795,8 +795,8 @@ int netconfig_add_route_ipv6(gchar *ip_addr, gchar *interface, gchar *gateway, u fd = socket(AF_INET6, SOCK_DGRAM, 0); if (fd < 0) { - strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); - DBG("Failed to create socket : %s", error_buf); + DBG("Failed to create socket : %s", + strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER)); return -1; } @@ -811,8 +811,8 @@ int netconfig_add_route_ipv6(gchar *ip_addr, gchar *interface, gchar *gateway, u } if ((err = ioctl(fd, SIOCADDRT, &rt)) < 0) { - strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); - DBG("Failed to add route: %s", error_buf); + DBG("Failed to add route: %s", + strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER)); close(fd); return -1; } diff --git a/src/wifi-agent.c b/src/wifi-agent.c index e66ffa4..b88ef56 100755 --- a/src/wifi-agent.c +++ b/src/wifi-agent.c @@ -201,7 +201,7 @@ gboolean handle_set_field(NetConnmanAgent *connman_agent, agent.passphrase = g_strdup(g_variant_get_string(value, NULL)); updated = TRUE; - DBG("Field [%s] - []", field); + DBG("Field [%s] - []", (gchar *)field); if (agent.passphrase == NULL) continue; @@ -233,21 +233,21 @@ gboolean handle_set_field(NetConnmanAgent *connman_agent, agent.wps_pbc = TRUE; updated = TRUE; - DBG("Field [%s] - [%d]", field, agent.wps_pbc); + DBG("Field [%s] - [%d]", (gchar *)field, agent.wps_pbc); } } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_WPS_PIN) == 0) { if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) { agent.wps_pin = g_strdup(g_variant_get_string(value, NULL)); updated = TRUE; - DBG("Field [%s] - [%s]", field, agent.wps_pin); + DBG("Field [%s] - [%s]", (gchar *)field, agent.wps_pin); } } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_NAME) == 0) { if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) { agent.name = g_strdup(g_variant_get_string(value, NULL)); updated = TRUE; - DBG("Field [%s] - [%s]", field, agent.name); + DBG("Field [%s] - [%s]", (gchar *)field, agent.name); } } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_SSID) == 0) { if (agent.ssid != NULL) { @@ -270,7 +270,7 @@ gboolean handle_set_field(NetConnmanAgent *connman_agent, memcpy(agent.ssid->data, array->data, array->len); updated = TRUE; - DBG("Field [%s] - []", field); + DBG("Field [%s] - []", (gchar *)field); } } } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_IDENTITY) == 0) { @@ -278,7 +278,7 @@ gboolean handle_set_field(NetConnmanAgent *connman_agent, agent.identity = g_strdup(g_variant_get_string(value, NULL)); updated = TRUE; - DBG("Field [%s] - [%s]", field, agent.identity); + DBG("Field [%s] - [%s]", (gchar *)field, agent.identity); } #if defined TIZEN_CAPTIVE_PORTAL } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_USERNAME) == 0) { @@ -286,14 +286,14 @@ gboolean handle_set_field(NetConnmanAgent *connman_agent, agent.username = g_strdup(g_variant_get_string(value, NULL)); updated = TRUE; - DBG("Field [%s] - [%s]", field, agent.username); + DBG("Field [%s] - [%s]", (gchar *)field, agent.username); } } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_PASSWORD) == 0) { if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) { agent.password = g_strdup(g_variant_get_string(value, NULL)); updated = TRUE; - DBG("Field [%s] - [%s]", field, agent.password); + DBG("Field [%s] - [%s]", (gchar *)field, agent.password); } #endif } diff --git a/src/wifi-config.c b/src/wifi-config.c index 1c7ae99..943a6cf 100755 --- a/src/wifi-config.c +++ b/src/wifi-config.c @@ -1715,7 +1715,7 @@ gboolean handle_set_config_field(Wifi *wifi, GDBusMethodInvocation *context, g_return_val_if_fail(config_id != NULL, TRUE); g_return_val_if_fail(key != NULL, TRUE); - DBG("Key[%s] Value[%d]", key, value); + DBG("Key[%s] Value[%s]", key, value); if (g_strcmp0(key, WIFI_CONFIG_PROXYADDRESS) == 0) { ret = _set_field(config_id, WIFI_CONFIG_PROXY_METHOD, "manual"); diff --git a/src/wifi-eap-config.c b/src/wifi-eap-config.c index 66f67eb..99d406b 100755 --- a/src/wifi-eap-config.c +++ b/src/wifi-eap-config.c @@ -196,7 +196,7 @@ static gboolean __netconfig_copy_config(const char *src, const char *dst) result = g_file_get_contents(src, &buf, &length, &error); if (result != TRUE) { - ERR("Failed to read %s[%s]", error->message); + ERR("Failed to read [%s]", error->message); g_error_free(error); return result; @@ -204,7 +204,7 @@ static gboolean __netconfig_copy_config(const char *src, const char *dst) result = g_file_set_contents(dst, buf, length, &error); if (result != TRUE) { - ERR("Failed to write %s[%s]", error->message); + ERR("Failed to write [%s]", error->message); g_error_free(error); } diff --git a/src/wifi-power.c b/src/wifi-power.c index c1e4aaf..71e9530 100755 --- a/src/wifi-power.c +++ b/src/wifi-power.c @@ -553,16 +553,15 @@ void wifi_set_early_suspend(gboolean value) ioctl_sock = socket(PF_INET, SOCK_DGRAM, 0); if (ioctl_sock < 0) { - strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); - DBG("socket(PF_INET,SOCK_DGRAM) failed: %s", error_buf); + DBG("socket(PF_INET,SOCK_DGRAM) failed: %s", + strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER)); return; } ret = ioctl(ioctl_sock, WLAN_IOCTL_SUSPEND, &ifr); - if (ret < 0) { - strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); - ERR("Fail to issue private commands: %d. %s", ret, error_buf); + ERR("Fail to issue private commands: %d. %s", ret, + strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER)); } else { old_state = value; } -- 2.7.4