/* Do POSIX file operation to create and remove config files,
* Do not use g_file_set_contents, it breaks inotify operations */
- if (fputs(data, file) < 0) {
+ if (data && fputs(data, file) < 0) {
ERR("Failed to write %s", config_file);
err = -EIO;
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;
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);
}
cert_file = strrchr(value, '/');
if (cert_file == NULL) {
ERR("Failed to get cert file: %s", value);
+ g_free(field);
+ g_free(value);
goto out;
}
WIFI_CERT_STORAGEDIR, encoded_ssid);
if (dirname == NULL) {
ERR("Failed to create dirname");
+ g_free(field);
+ g_free(value);
goto out;
}
if (g_file_test(dirname, G_FILE_TEST_IS_DIR) != TRUE) {
S_IXGRP | S_IROTH | S_IXOTH) < 0) {
if (errno != EEXIST) {
g_free(dirname);
+ g_free(field);
+ g_free(value);
goto out;
}
}
WIFI_CERT_STORAGEDIR, encoded_ssid, cert_file);
if (cert_path == NULL) {
ERR("Failed to create cert path");
+ g_free(field);
+ g_free(value);
goto out;
}
if (__netconfig_copy_config(value, cert_path) != TRUE) {
ERR("Failed to read cert file %s", value);
g_free(cert_path);
+ g_free(field);
+ g_free(value);
goto out;
}
ERR("get config_id [%s] from [%s]", config_id, profile);
ret = wifi_config_remove_configuration(config_id);
- if (ret != TRUE) {
+ if (ret != TRUE)
ERR("Fail to wifi_config_remove_configuration [%s]", config_id);
- }
- if (config_id != NULL) {
+ if (config_id != NULL)
g_free(config_id);
- }
return ret;
}
return FALSE;
}
- if (_delete_configuration(profile) != TRUE) {
+ if (_delete_configuration(profile) != TRUE)
ERR("Fail to delete configuration [%s]", profile);
- }
wifi_ident = strstr(profile, "wifi_");
if (wifi_ident == NULL) {
const gchar *service, GVariant *fields)
{
gboolean updated = FALSE;
- gboolean reply = FALSE;
gboolean result = FALSE;
- g_return_val_if_fail(wifi != NULL, FALSE);
+ g_return_val_if_fail(wifi != NULL, TRUE);
DBG("Set agent fields for %s", service);
if (netconfig_is_wifi_profile(service) != TRUE) {
netconfig_error_dbus_method_return(context, NETCONFIG_ERROR_WRONG_PROFILE, "InvalidService");
- return reply;
+ return TRUE;
}
updated = __netconfig_create_config(fields);
if (result != TRUE)
ERR("Fail to connect %s", service);
- else
- reply = TRUE;
- return reply;
+ return TRUE;
}
gboolean handle_delete_eap_config(Wifi *wifi, GDBusMethodInvocation *context,
const gchar *profile)
{
- g_return_val_if_fail(wifi != NULL, FALSE);
+ g_return_val_if_fail(wifi != NULL, TRUE);
wifi_complete_delete_eap_config(wifi, context);
- gboolean ret = __netconfig_delete_config((const char *)profile);
+ __netconfig_delete_config((const char *)profile);
- return ret;
+ return TRUE;
}