Commit 3161f170 authored by spiiroin's avatar spiiroin

[usb-moded] Normalize use of return statement

As 'return' is not a function, do not make it look like one.
Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
parent 94a484c2
...@@ -258,7 +258,7 @@ int appsync_activate_sync(const char *mode) ...@@ -258,7 +258,7 @@ int appsync_activate_sync(const char *mode)
#ifdef APP_SYNC_DBUS #ifdef APP_SYNC_DBUS
appsync_enumerate_usb(); appsync_enumerate_usb();
#endif #endif
return(0); return 0;
} }
#ifdef APP_SYNC_DBUS #ifdef APP_SYNC_DBUS
...@@ -307,11 +307,11 @@ int appsync_activate_sync(const char *mode) ...@@ -307,11 +307,11 @@ int appsync_activate_sync(const char *mode)
} }
} }
return(0); return 0;
error: error:
log_warning("Error launching a service!\n"); log_warning("Error launching a service!\n");
return(1); return 1;
} }
int appsync_activate_sync_post(const char *mode) int appsync_activate_sync_post(const char *mode)
...@@ -365,11 +365,11 @@ int appsync_activate_sync_post(const char *mode) ...@@ -365,11 +365,11 @@ int appsync_activate_sync_post(const char *mode)
} }
} }
return(0); return 0;
error: error:
log_warning("Error launching a service!\n"); log_warning("Error launching a service!\n");
return(1); return 1;
} }
int appsync_mark_active(const gchar *name, int post) int appsync_mark_active(const gchar *name, int post)
...@@ -511,5 +511,5 @@ int appsync_stop(gboolean force) ...@@ -511,5 +511,5 @@ int appsync_stop(gboolean force)
#ifdef APP_SYNC_DBUS #ifdef APP_SYNC_DBUS
appsync_cancel_enumerate_usb_timer(); appsync_cancel_enumerate_usb_timer();
#endif #endif
return(0); return 0;
} }
...@@ -113,12 +113,12 @@ static int config_validate_ip(const char *ipadd) ...@@ -113,12 +113,12 @@ static int config_validate_ip(const char *ipadd)
unsigned char c; unsigned char c;
if (sscanf(ipadd, "%3u.%3u.%3u.%3u%c", &b1, &b2, &b3, &b4, &c) != 4) if (sscanf(ipadd, "%3u.%3u.%3u.%3u%c", &b1, &b2, &b3, &b4, &c) != 4)
return(-1); return -1;
if ((b1 | b2 | b3 | b4) > 255) if ((b1 | b2 | b3 | b4) > 255)
return(-1); return -1;
if (strspn(ipadd, "0123456789.") < strlen(ipadd)) if (strspn(ipadd, "0123456789.") < strlen(ipadd))
return(-1); return -1;
/* all ok */ /* all ok */
return 0; return 0;
} }
...@@ -134,53 +134,53 @@ char *config_find_mounts(void) ...@@ -134,53 +134,53 @@ char *config_find_mounts(void)
ret = g_strdup(FS_MOUNT_DEFAULT); ret = g_strdup(FS_MOUNT_DEFAULT);
log_debug("Default mount = %s\n", ret); log_debug("Default mount = %s\n", ret);
} }
return(ret); return ret;
} }
int config_find_sync(void) int config_find_sync(void)
{ {
return(config_get_conf_int(FS_SYNC_ENTRY, FS_SYNC_KEY)); return config_get_conf_int(FS_SYNC_ENTRY, FS_SYNC_KEY);
} }
char * config_find_alt_mount(void) char * config_find_alt_mount(void)
{ {
return(config_get_conf_string(ALT_MOUNT_ENTRY, ALT_MOUNT_KEY)); return config_get_conf_string(ALT_MOUNT_ENTRY, ALT_MOUNT_KEY);
} }
char * config_find_udev_path(void) char * config_find_udev_path(void)
{ {
return(config_get_conf_string(UDEV_PATH_ENTRY, UDEV_PATH_KEY)); return config_get_conf_string(UDEV_PATH_ENTRY, UDEV_PATH_KEY);
} }
char * config_find_udev_subsystem(void) char * config_find_udev_subsystem(void)
{ {
return(config_get_conf_string(UDEV_PATH_ENTRY, UDEV_SUBSYSTEM_KEY)); return config_get_conf_string(UDEV_PATH_ENTRY, UDEV_SUBSYSTEM_KEY);
} }
char * config_check_trigger(void) char * config_check_trigger(void)
{ {
return(config_get_conf_string(TRIGGER_ENTRY, TRIGGER_PATH_KEY)); return config_get_conf_string(TRIGGER_ENTRY, TRIGGER_PATH_KEY);
} }
char * config_get_trigger_subsystem(void) char * config_get_trigger_subsystem(void)
{ {
return(config_get_conf_string(TRIGGER_ENTRY, TRIGGER_UDEV_SUBSYSTEM)); return config_get_conf_string(TRIGGER_ENTRY, TRIGGER_UDEV_SUBSYSTEM);
} }
char * config_get_trigger_mode(void) char * config_get_trigger_mode(void)
{ {
return(config_get_conf_string(TRIGGER_ENTRY, TRIGGER_MODE_KEY)); return config_get_conf_string(TRIGGER_ENTRY, TRIGGER_MODE_KEY);
} }
char * config_get_trigger_property(void) char * config_get_trigger_property(void)
{ {
return(config_get_conf_string(TRIGGER_ENTRY, TRIGGER_PROPERTY_KEY)); return config_get_conf_string(TRIGGER_ENTRY, TRIGGER_PROPERTY_KEY);
} }
char * config_get_trigger_value(void) char * config_get_trigger_value(void)
{ {
return(config_get_conf_string(TRIGGER_ENTRY, TRIGGER_PROPERTY_VALUE_KEY)); return config_get_conf_string(TRIGGER_ENTRY, TRIGGER_PROPERTY_VALUE_KEY);
} }
static char * config_get_network_ip(void) static char * config_get_network_ip(void)
...@@ -188,37 +188,37 @@ static char * config_get_network_ip(void) ...@@ -188,37 +188,37 @@ static char * config_get_network_ip(void)
char * ip = config_get_kcmdline_string(NETWORK_IP_KEY); char * ip = config_get_kcmdline_string(NETWORK_IP_KEY);
if (ip != NULL) if (ip != NULL)
if(!config_validate_ip(ip)) if(!config_validate_ip(ip))
return(ip); return ip;
return(config_get_conf_string(NETWORK_ENTRY, NETWORK_IP_KEY)); return config_get_conf_string(NETWORK_ENTRY, NETWORK_IP_KEY);
} }
static char * config_get_network_interface(void) static char * config_get_network_interface(void)
{ {
return(config_get_conf_string(NETWORK_ENTRY, NETWORK_INTERFACE_KEY)); return config_get_conf_string(NETWORK_ENTRY, NETWORK_INTERFACE_KEY);
} }
static char * config_get_network_gateway(void) static char * config_get_network_gateway(void)
{ {
char * gw = config_get_kcmdline_string(NETWORK_GATEWAY_KEY); char * gw = config_get_kcmdline_string(NETWORK_GATEWAY_KEY);
if (gw != NULL) if (gw != NULL)
return(gw); return gw;
return(config_get_conf_string(NETWORK_ENTRY, NETWORK_GATEWAY_KEY)); return config_get_conf_string(NETWORK_ENTRY, NETWORK_GATEWAY_KEY);
} }
static char * config_get_network_netmask(void) static char * config_get_network_netmask(void)
{ {
char * netmask = config_get_kcmdline_string(NETWORK_NETMASK_KEY); char * netmask = config_get_kcmdline_string(NETWORK_NETMASK_KEY);
if (netmask != NULL) if (netmask != NULL)
return(netmask); return netmask;
return(config_get_conf_string(NETWORK_ENTRY, NETWORK_NETMASK_KEY)); return config_get_conf_string(NETWORK_ENTRY, NETWORK_NETMASK_KEY);
} }
static char * config_get_network_nat_interface(void) static char * config_get_network_nat_interface(void)
{ {
return(config_get_conf_string(NETWORK_ENTRY, NETWORK_NAT_INTERFACE_KEY)); return config_get_conf_string(NETWORK_ENTRY, NETWORK_NAT_INTERFACE_KEY);
} }
/* create basic conffile with sensible defaults */ /* create basic conffile with sensible defaults */
...@@ -281,7 +281,7 @@ static int config_get_conf_int(const gchar *entry, const gchar *key) ...@@ -281,7 +281,7 @@ static int config_get_conf_int(const gchar *entry, const gchar *key)
} }
g_strfreev(origkeys); g_strfreev(origkeys);
g_key_file_free(settingsfile); g_key_file_free(settingsfile);
return(ret); return ret;
} }
...@@ -318,7 +318,7 @@ static char * config_get_conf_string(const gchar *entry, const gchar *key) ...@@ -318,7 +318,7 @@ static char * config_get_conf_string(const gchar *entry, const gchar *key)
g_strfreev(origkeys); g_strfreev(origkeys);
end: end:
g_key_file_free(settingsfile); g_key_file_free(settingsfile);
return(tmp_char); return tmp_char;
} }
...@@ -337,7 +337,7 @@ static char * config_get_kcmdline_string(const char *entry) ...@@ -337,7 +337,7 @@ static char * config_get_kcmdline_string(const char *entry)
if ((fd = open("/proc/cmdline", O_RDONLY)) < 0) if ((fd = open("/proc/cmdline", O_RDONLY)) < 0)
{ {
log_debug("could not read /proc/cmdline"); log_debug("could not read /proc/cmdline");
return(ret); return ret;
} }
len = read(fd, cmdLine, sizeof cmdLine - 1); len = read(fd, cmdLine, sizeof cmdLine - 1);
...@@ -346,7 +346,7 @@ static char * config_get_kcmdline_string(const char *entry) ...@@ -346,7 +346,7 @@ static char * config_get_kcmdline_string(const char *entry)
if (len <= 0) if (len <= 0)
{ {
log_debug("kernel command line was empty"); log_debug("kernel command line was empty");
return(ret); return ret;
} }
cmdLine[len] = '\0'; cmdLine[len] = '\0';
...@@ -356,7 +356,7 @@ static char * config_get_kcmdline_string(const char *entry) ...@@ -356,7 +356,7 @@ static char * config_get_kcmdline_string(const char *entry)
if (!g_shell_parse_argv(cmdLine, &argc, &argv, &optErr)) if (!g_shell_parse_argv(cmdLine, &argc, &argv, &optErr))
{ {
g_error_free(optErr); g_error_free(optErr);
return(ret); return ret;
} }
/* find the ip token */ /* find the ip token */
...@@ -395,7 +395,7 @@ static char * config_get_kcmdline_string(const char *entry) ...@@ -395,7 +395,7 @@ static char * config_get_kcmdline_string(const char *entry)
g_strfreev(argv); g_strfreev(argv);
g_strfreev(network_tokens); g_strfreev(network_tokens);
return(ret); return ret;
} }
char * config_get_mode_setting(void) char * config_get_mode_setting(void)
...@@ -464,14 +464,14 @@ set_config_result_t config_set_config_setting(const char *entry, const char *key ...@@ -464,14 +464,14 @@ set_config_result_t config_set_config_setting(const char *entry, const char *key
ret = SET_CONFIG_UPDATED; ret = SET_CONFIG_UPDATED;
g_free(keyfile); g_free(keyfile);
return (ret); return ret;
} }
set_config_result_t config_set_mode_setting(const char *mode) set_config_result_t config_set_mode_setting(const char *mode)
{ {
if (strcmp(mode, MODE_ASK) && common_valid_mode(mode)) if (strcmp(mode, MODE_ASK) && common_valid_mode(mode))
return SET_CONFIG_ERROR; return SET_CONFIG_ERROR;
return (config_set_config_setting(MODE_SETTING_ENTRY, MODE_SETTING_KEY, mode)); return config_set_config_setting(MODE_SETTING_ENTRY, MODE_SETTING_KEY, mode);
} }
/* Builds the string used for hidden modes, when hide set to one builds the /* Builds the string used for hidden modes, when hide set to one builds the
...@@ -553,7 +553,7 @@ set_config_result_t config_set_hide_mode_setting(const char *mode) ...@@ -553,7 +553,7 @@ set_config_result_t config_set_hide_mode_setting(const char *mode)
g_free(hidden_modes); g_free(hidden_modes);
return(ret); return ret;
} }
set_config_result_t config_set_unhide_mode_setting(const char *mode) set_config_result_t config_set_unhide_mode_setting(const char *mode)
...@@ -574,7 +574,7 @@ set_config_result_t config_set_unhide_mode_setting(const char *mode) ...@@ -574,7 +574,7 @@ set_config_result_t config_set_unhide_mode_setting(const char *mode)
g_free(hidden_modes); g_free(hidden_modes);
return(ret); return ret;
} }
set_config_result_t config_set_mode_whitelist(const char *whitelist) set_config_result_t config_set_mode_whitelist(const char *whitelist)
...@@ -619,7 +619,7 @@ set_config_result_t config_set_mode_in_whitelist(const char *mode, int allowed) ...@@ -619,7 +619,7 @@ set_config_result_t config_set_mode_in_whitelist(const char *mode, int allowed)
g_free(whitelist); g_free(whitelist);
return(ret); return ret;
} }
/* /*
...@@ -708,7 +708,7 @@ char * config_get_network_setting(const char *config) ...@@ -708,7 +708,7 @@ char * config_get_network_setting(const char *config)
ret = strdup("usb0"); ret = strdup("usb0");
} }
else if(!strcmp(config, NETWORK_GATEWAY_KEY)) else if(!strcmp(config, NETWORK_GATEWAY_KEY))
return(config_get_network_gateway()); return config_get_network_gateway();
else if(!strcmp(config, NETWORK_NETMASK_KEY)) else if(!strcmp(config, NETWORK_NETMASK_KEY))
{ {
ret = config_get_network_netmask(); ret = config_get_network_netmask();
...@@ -716,12 +716,12 @@ char * config_get_network_setting(const char *config) ...@@ -716,12 +716,12 @@ char * config_get_network_setting(const char *config)
ret = strdup("255.255.255.0"); ret = strdup("255.255.255.0");
} }
else if(!strcmp(config, NETWORK_NAT_INTERFACE_KEY)) else if(!strcmp(config, NETWORK_NAT_INTERFACE_KEY))
return(config_get_network_nat_interface()); return config_get_network_nat_interface();
else else
/* no matching keys, return error */ /* no matching keys, return error */
return(NULL); return NULL;
end: end:
return(ret); return ret;
} }
/** /**
...@@ -896,7 +896,7 @@ char * config_get_android_manufacturer(void) ...@@ -896,7 +896,7 @@ char * config_get_android_manufacturer(void)
char * config_get_android_vendor_id(void) char * config_get_android_vendor_id(void)
{ {
return(config_get_conf_string(ANDROID_ENTRY, ANDROID_VENDOR_ID_KEY)); return config_get_conf_string(ANDROID_ENTRY, ANDROID_VENDOR_ID_KEY);
} }
char * config_get_android_product(void) char * config_get_android_product(void)
...@@ -916,19 +916,19 @@ char * config_get_android_product(void) ...@@ -916,19 +916,19 @@ char * config_get_android_product(void)
char * config_get_android_product_id(void) char * config_get_android_product_id(void)
{ {
return(config_get_conf_string(ANDROID_ENTRY, ANDROID_PRODUCT_ID_KEY)); return config_get_conf_string(ANDROID_ENTRY, ANDROID_PRODUCT_ID_KEY);
} }
char * config_get_hidden_modes(void) char * config_get_hidden_modes(void)
{ {
return(config_get_conf_string(MODE_SETTING_ENTRY, MODE_HIDE_KEY)); return config_get_conf_string(MODE_SETTING_ENTRY, MODE_HIDE_KEY);
} }
char * config_get_mode_whitelist(void) char * config_get_mode_whitelist(void)
{ {
return(config_get_conf_string(MODE_SETTING_ENTRY, MODE_WHITELIST_KEY)); return config_get_conf_string(MODE_SETTING_ENTRY, MODE_WHITELIST_KEY);
} }
int config_is_roaming_not_allowed(void) int config_is_roaming_not_allowed(void)
{ {
return(config_get_conf_int(NETWORK_ENTRY, NO_ROAMING_KEY)); return config_get_conf_int(NETWORK_ENTRY, NO_ROAMING_KEY);
} }
...@@ -802,7 +802,7 @@ EXIT: ...@@ -802,7 +802,7 @@ EXIT:
*/ */
int umdbus_send_state_signal(const char *state_ind) int umdbus_send_state_signal(const char *state_ind)
{ {
return(umdbus_send_signal_ex(USB_MODE_SIGNAL_NAME, state_ind)); return umdbus_send_signal_ex(USB_MODE_SIGNAL_NAME, state_ind);
} }
/** /**
...@@ -814,7 +814,7 @@ int umdbus_send_state_signal(const char *state_ind) ...@@ -814,7 +814,7 @@ int umdbus_send_state_signal(const char *state_ind)
*/ */
int umdbus_send_error_signal(const char *error) int umdbus_send_error_signal(const char *error)
{ {
return(umdbus_send_signal_ex(USB_MODE_ERROR_SIGNAL_NAME, error)); return umdbus_send_signal_ex(USB_MODE_ERROR_SIGNAL_NAME, error);
} }
/** /**
...@@ -826,7 +826,7 @@ int umdbus_send_error_signal(const char *error) ...@@ -826,7 +826,7 @@ int umdbus_send_error_signal(const char *error)
*/ */
int umdbus_send_supported_modes_signal(const char *supported_modes) int umdbus_send_supported_modes_signal(const char *supported_modes)
{ {
return(umdbus_send_signal_ex(USB_MODE_SUPPORTED_MODES_SIGNAL_NAME, supported_modes)); return umdbus_send_signal_ex(USB_MODE_SUPPORTED_MODES_SIGNAL_NAME, supported_modes);
} }
/** /**
...@@ -838,7 +838,7 @@ int umdbus_send_supported_modes_signal(const char *supported_modes) ...@@ -838,7 +838,7 @@ int umdbus_send_supported_modes_signal(const char *supported_modes)
*/ */
int umdbus_send_available_modes_signal(const char *available_modes) int umdbus_send_available_modes_signal(const char *available_modes)
{ {
return(umdbus_send_signal_ex(USB_MODE_AVAILABLE_MODES_SIGNAL_NAME, available_modes)); return umdbus_send_signal_ex(USB_MODE_AVAILABLE_MODES_SIGNAL_NAME, available_modes);
} }
/** /**
...@@ -850,7 +850,7 @@ int umdbus_send_available_modes_signal(const char *available_modes) ...@@ -850,7 +850,7 @@ int umdbus_send_available_modes_signal(const char *available_modes)
*/ */
int umdbus_send_hidden_modes_signal(const char *hidden_modes) int umdbus_send_hidden_modes_signal(const char *hidden_modes)
{ {
return(umdbus_send_signal_ex(USB_MODE_HIDDEN_MODES_SIGNAL_NAME, hidden_modes)); return umdbus_send_signal_ex(USB_MODE_HIDDEN_MODES_SIGNAL_NAME, hidden_modes);
} }
/** /**
...@@ -861,7 +861,7 @@ int umdbus_send_hidden_modes_signal(const char *hidden_modes) ...@@ -861,7 +861,7 @@ int umdbus_send_hidden_modes_signal(const char *hidden_modes)
*/ */
int umdbus_send_whitelisted_modes_signal(const char *whitelist) int umdbus_send_whitelisted_modes_signal(const char *whitelist)
{ {
return(umdbus_send_signal_ex(USB_MODE_WHITELISTED_MODES_SIGNAL_NAME, whitelist)); return umdbus_send_signal_ex(USB_MODE_WHITELISTED_MODES_SIGNAL_NAME, whitelist);
} }
/** Async reply handler for umdbus_get_name_owner_async() /** Async reply handler for umdbus_get_name_owner_async()
......
...@@ -125,7 +125,7 @@ GList *dynconfig_read_mode_list(int diag) ...@@ -125,7 +125,7 @@ GList *dynconfig_read_mode_list(int diag)
log_debug("Mode confdir open failed or file is incomplete/invalid.\n"); log_debug("Mode confdir open failed or file is incomplete/invalid.\n");
modelist = g_list_sort (modelist, dynconfig_compare_modes); modelist = g_list_sort (modelist, dynconfig_compare_modes);
return(modelist); return modelist;
} }
static mode_list_elem_t *dynconfig_read_mode_file(const gchar *filename) static mode_list_elem_t *dynconfig_read_mode_file(const gchar *filename)
......
...@@ -97,7 +97,7 @@ char * mac_read_mac(void) ...@@ -97,7 +97,7 @@ char * mac_read_mac(void)
if(!g_ether) if(!g_ether)
{ {
log_warning("Failed to read mac address from /etc/modprobe.d/g_ether.conf\n"); log_warning("Failed to read mac address from /etc/modprobe.d/g_ether.conf\n");
return(NULL); return NULL;
} }
test = fseek(g_ether, 26, SEEK_SET); test = fseek(g_ether, 26, SEEK_SET);
if(test == -1) if(test == -1)
...@@ -115,5 +115,5 @@ char * mac_read_mac(void) ...@@ -115,5 +115,5 @@ char * mac_read_mac(void)
free(mac); free(mac);
fclose(g_ether); fclose(g_ether);
return(ret); return ret;
} }
...@@ -224,7 +224,7 @@ int modules_load_module(const char *module) ...@@ -224,7 +224,7 @@ int modules_load_module(const char *module)
log_info("Module %s loaded successfully\n", module); log_info("Module %s loaded successfully\n", module);
else else
log_info("Module %s failed to load\n", module); log_info("Module %s failed to load\n", module);
return(ret); return ret;
} }
/** unload module /** unload module
...@@ -251,5 +251,5 @@ int modules_unload_module(const char *module) ...@@ -251,5 +251,5 @@ int modules_unload_module(const char *module)
ret = kmod_module_remove_module(mod, KMOD_REMOVE_NOWAIT); ret = kmod_module_remove_module(mod, KMOD_REMOVE_NOWAIT);
kmod_module_unref(mod); kmod_module_unref(mod);
return(ret); return ret;
} }
...@@ -181,7 +181,7 @@ static int network_set_usb_ip_forward(mode_list_elem_t *data, ipforward_data_t * ...@@ -181,7 +181,7 @@ static int network_set_usb_ip_forward(mode_list_elem_t *data, ipforward_data_t *
interface = network_get_interface(data); interface = network_get_interface(data);
if(interface == NULL) if(interface == NULL)
return(1); return 1;
nat_interface = config_get_network_setting(NETWORK_NAT_INTERFACE_KEY); nat_interface = config_get_network_setting(NETWORK_NAT_INTERFACE_KEY);
if((nat_interface == NULL) && (ipforward->nat_interface != NULL)) if((nat_interface == NULL) && (ipforward->nat_interface != NULL))
nat_interface = strdup(ipforward->nat_interface); nat_interface = strdup(ipforward->nat_interface);
...@@ -194,7 +194,7 @@ static int network_set_usb_ip_forward(mode_list_elem_t *data, ipforward_data_t * ...@@ -194,7 +194,7 @@ static int network_set_usb_ip_forward(mode_list_elem_t *data, ipforward_data_t *
#endif #endif
free(interface); free(interface);
free(nat_interface); free(nat_interface);
return(1); return 1;
} }
write_to_file("/proc/sys/net/ipv4/ip_forward", "1"); write_to_file("/proc/sys/net/ipv4/ip_forward", "1");
snprintf(command, 128, "/sbin/iptables -t nat -A POSTROUTING -o %s -j MASQUERADE", nat_interface); snprintf(command, 128, "/sbin/iptables -t nat -A POSTROUTING -o %s -j MASQUERADE", nat_interface);
...@@ -209,7 +209,7 @@ static int network_set_usb_ip_forward(mode_list_elem_t *data, ipforward_data_t * ...@@ -209,7 +209,7 @@ static int network_set_usb_ip_forward(mode_list_elem_t *data, ipforward_data_t *
free(interface); free(interface);
free(nat_interface); free(nat_interface);
log_debug("ipforwarding success!\n"); log_debug("ipforwarding success!\n");
return(0); return 0;
} }
/** /**
...@@ -294,7 +294,7 @@ static int get_roaming(void) ...@@ -294,7 +294,7 @@ static int get_roaming(void)
ret = 1; ret = 1;
} }
return(ret); return ret;
} }
#endif #endif
...@@ -312,7 +312,7 @@ static int resolv_conf_dns(ipforward_data_t *ipforward) ...@@ -312,7 +312,7 @@ static int resolv_conf_dns(ipforward_data_t *ipforward)
resolv = fopen("/etc/resolv.conf", "r"); resolv = fopen("/etc/resolv.conf", "r");
if (resolv == NULL) if (resolv == NULL)
return(1); return 1;
/* we don't expect more than 10 lines in /etc/resolv.conf */ /* we don't expect more than 10 lines in /etc/resolv.conf */
for (i=0; i < 10; i++) for (i=0; i < 10; i++)
...@@ -337,7 +337,7 @@ static int resolv_conf_dns(ipforward_data_t *ipforward) ...@@ -337,7 +337,7 @@ static int resolv_conf_dns(ipforward_data_t *ipforward)
end: end:
free(line); free(line);
fclose(resolv); fclose(resolv);
return(0); return 0;
} }
#endif #endif
...@@ -352,7 +352,7 @@ static int network_checklink(void) ...@@ -352,7 +352,7 @@ static int network_checklink(void)
dest[len] = 0; dest[len] = 0;
ret = strcmp(dest, UDHCP_CONFIG_PATH); ret = strcmp(dest, UDHCP_CONFIG_PATH);
} }
return(ret); return ret;
} }
/** /**
...@@ -373,14 +373,14 @@ static int network_write_udhcpd_conf(ipforward_data_t *ipforward, mode_list_elem ...@@ -373,14 +373,14 @@ static int network_write_udhcpd_conf(ipforward_data_t *ipforward, mode_list_elem
if(conffile == NULL) if(conffile == NULL)
{ {
log_debug("Error creating "UDHCP_CONFIG_PATH"!\n"); log_debug("Error creating "UDHCP_CONFIG_PATH"!\n");
return(1); return 1;
} }
interface = network_get_interface(data); interface = network_get_interface(data);
if(interface == NULL) if(interface == NULL)
{ {
fclose(conffile); fclose(conffile);
return(1); return 1;
} }
/* generate start and end ip based on the setting */ /* generate start and end ip based on the setting */
ip = config_get_network_setting(NETWORK_IP_KEY); ip = config_get_network_setting(NETWORK_IP_KEY);
...@@ -452,12 +452,12 @@ link: ...@@ -452,12 +452,12 @@ link:
{ {
log_debug("Error creating link "UDHCP_CONFIG_LINK" -> "UDHCP_CONFIG_PATH": %m\n"); log_debug("Error creating link "UDHCP_CONFIG_LINK" -> "UDHCP_CONFIG_PATH": %m\n");
unlink(UDHCP_CONFIG_PATH); unlink(UDHCP_CONFIG_PATH);
return(1); return 1;
} }
end: end:
log_debug(UDHCP_CONFIG_LINK" created\n"); log_debug(UDHCP_CONFIG_LINK" created\n");
return(0);