GVariant *g_var;
guint info;
__tethering_h *th = (__tethering_h *)user_data;
- tethering_error_e tethering_error;
+ tethering_error_e tethering_error = TETHERING_ERROR_NONE;
g_var = g_dbus_proxy_call_finish(th->client_bus_proxy, res, &g_error);
if (g_error) {
return;
}
g_variant_get(g_var, "(u)", &info);
- tethering_error = __get_error(info);
+ if (tethering_error == TETHERING_ERROR_NONE)
+ tethering_error = __get_error(info);
g_variant_unref(g_var);
th->settings_reloaded_cb(tethering_error,
fclose(fp);
fclose(fp1);
- if ((strcmp(filepath, ALLOWED_LIST) == 0))
- rename(TEMP_LIST, ALLOWED_LIST);
- else if ((strcmp(filepath, BLOCKED_LIST) == 0))
- rename(TEMP_LIST, BLOCKED_LIST);
+ if ((strcmp(filepath, ALLOWED_LIST) == 0)) {
+ if (rename(TEMP_LIST, ALLOWED_LIST) != 0) {
+ ERR("rename is failed (%s -> %s)", TEMP_LIST, ALLOWED_LIST);
+ return TETHERING_ERROR_OPERATION_FAILED;
+ }
+ } else if ((strcmp(filepath, BLOCKED_LIST) == 0)) {
+ if (rename(TEMP_LIST, BLOCKED_LIST) != 0) {
+ ERR("rename is failed (%s -> %s)", TEMP_LIST, BLOCKED_LIST);
+ return TETHERING_ERROR_OPERATION_FAILED;
+ }
+ }
return TETHERING_ERROR_NONE;
}
int error = TETHERING_ERROR_NONE;
error = tethering_wifi_get_ssid(th, &ssid);
- if (error != TETHERING_ERROR_NONE)
- __is_err(error);
- else
+ if (error == TETHERING_ERROR_NONE)
g_print("\n\t** WiFi tethering SSID : %s\n", ssid);
error = tethering_wifi_get_passphrase(th, &passphrase);
- if (error != TETHERING_ERROR_NONE)
- __is_err(error);
- else
+ if (error == TETHERING_ERROR_NONE)
g_print("\t** WiFi tethering passphrase : %s\n", passphrase);
error = tethering_wifi_get_ssid_visibility(th, &visibility);
- if (error != TETHERING_ERROR_NONE)
- __is_err(error);
- else
+ if (error == TETHERING_ERROR_NONE)
g_print("\t** WiFi tethering ssid visibility : %s\n",
visibility ? "visible" : "invisible");
error = tethering_wifi_get_security_type(th, &security_type);
- if (error != TETHERING_ERROR_NONE)
- __is_err(error);
- else {
+ if (error == TETHERING_ERROR_NONE) {
switch (security_type) {
case TETHERING_WIFI_SECURITY_TYPE_NONE:
sec_str = "open";
}
error = tethering_wifi_get_mode(th, &hw_mode);
- if (error != TETHERING_ERROR_NONE)
- __is_err(error);
- else
+ if (error == TETHERING_ERROR_NONE)
g_print("\t** WiFi tethering mode : %d\n", hw_mode);
error = tethering_wifi_get_channel(th, &channel);
- if (error != TETHERING_ERROR_NONE)
- __is_err(error);
- else
+ if (error == TETHERING_ERROR_NONE)
g_print("\t** WiFi tethering channel : %d\n", channel);
error = tethering_wifi_get_max_connected_device(th, &max_connected);
- if (error != TETHERING_ERROR_NONE)
- __is_err(error);
- else
+ if (error == TETHERING_ERROR_NONE)
g_print("\t** WiFi tethering max connected device : %d\n", max_connected);
error = tethering_wifi_get_mac_filter(th, &mac_filter);
- if (error != TETHERING_ERROR_NONE)
- __is_err(error);
- else
+ if (error == TETHERING_ERROR_NONE)
g_print("\t** WiFi tethering mac filter : %s\n",
mac_filter ? "enable" : "disable");
error = tethering_wifi_is_port_filtering_enabled(th, &filtering_enabled);
- if (error != TETHERING_ERROR_NONE)
- __is_err(error);
- else
+ if (error == TETHERING_ERROR_NONE)
g_print("\t** WiFi tethering port filtering : %s\n",
filtering_enabled ? "enable" : "disable");
error = tethering_wifi_is_port_forwarding_enabled(th, &forwarding_enabled);
- if (error != TETHERING_ERROR_NONE)
- __is_err(error);
- else
+ if (error == TETHERING_ERROR_NONE)
g_print("\t** WiFi tethering port forwarding : %s\n",
forwarding_enabled ? "enable" : "disable");
} else if (list && !option) {
/* Add to blocked mac list */
ret = tethering_wifi_add_blocked_mac_list(th, mac);
- } else if (list && option) {
+ } else {
/* Remove from blocked mac list */
ret = tethering_wifi_remove_blocked_mac_list(th, mac);
- } else {
- printf("Input failed!!\n");
- return -1;
}
if (ret < 0)