From 26bd75a149f8c7bd4fbf30b95aafe383ecbdae85 Mon Sep 17 00:00:00 2001 From: hyunuktak Date: Mon, 5 Dec 2016 16:49:14 +0900 Subject: [PATCH] Add a file path to check mac address Fix build error for common 64bit Emulator Fix a svace for memory leak Change-Id: I7f63817d5bc6492e514dd6bfd81b8709f5a75727 Signed-off-by: hyunuktak --- packaging/net-config.spec | 5 ++++- src/utils/util.c | 7 ++++++- src/wifi-config.c | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packaging/net-config.spec b/packaging/net-config.spec index f384165..01b2f00 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.94 +Version: 1.1.96 Release: 2 Group: System/Network License: Apache-2.0 @@ -82,6 +82,9 @@ mkdir -p %{buildroot}%{_unitdir} cp resources/usr/lib/systemd/system/net-config_tv.service %{buildroot}%{_libdir}/systemd/system/net-config.service mkdir -p %{buildroot}%{_libdir}/udev/rules.d/ cp resources/usr/lib/udev/rules.d/99-wifiusb-dev.rules %{buildroot}%{_libdir}/udev/rules.d/99-wifiusb-dev.rules +%if "%{?_lib}" == "lib64" +cp resources/usr/lib/systemd/system/net-config_tv.service %{buildroot}%{_unitdir}/net-config.service +%endif %else cp resources/usr/lib/systemd/system/net-config.service %{buildroot}%{_libdir}/systemd/system/net-config.service %if "%{?_lib}" == "lib64" diff --git a/src/utils/util.c b/src/utils/util.c index 8376291..f1c42f4 100755 --- a/src/utils/util.c +++ b/src/utils/util.c @@ -46,6 +46,7 @@ #define DBUS_SERVICE_DBUS "org.freedesktop.DBus" #define DBUS_INTERFACE_DBUS "org.freedesktop.DBus" #define MAC_INFO_FILEPATH tzplatform_mkpath(TZ_SYS_ETC, "/.mac.info") +#define MAC_ADDRESS_FILEPATH "/sys/class/net/wlan0/address" #define MAC_ADDRESS_MAX_LEN 18 static gboolean netconfig_device_picker_test = FALSE; @@ -1054,7 +1055,11 @@ void netconfig_set_mac_address_from_file(void) file = fopen(MAC_INFO_FILEPATH, "r"); if (file == NULL) { ERR("Fail to open %s", MAC_INFO_FILEPATH); - return; + file = fopen(MAC_ADDRESS_FILEPATH, "r"); + if (file == NULL) { + ERR("Fail to open %s", MAC_ADDRESS_FILEPATH); + return; + } } if (fgets(mac_str, sizeof(mac_str), file) == NULL) { ERR("Fail to read mac address"); diff --git a/src/wifi-config.c b/src/wifi-config.c index 1c590dd..9a910e8 100755 --- a/src/wifi-config.c +++ b/src/wifi-config.c @@ -217,9 +217,10 @@ static GKeyFile *__get_configuration_keyfile(const gchar *group_name) keyfile = netconfig_keyfile_load(path); if (keyfile == NULL) { ERR("keyfile[%s] is NULL", path); - g_free(path); } + g_free(path); + return keyfile; } -- 2.34.1