gboolean request_started;
};
-const static char* url_list[] = {
+static const char* url_list[] = {
"www.google.com",
"www.msn.com",
"www.yahoo.com",
"m.google.com",
"www.amazon.com",
"www.youtube.com"
- };
+};
#define URL_LIST_NUM 6
* then no Internet is available */
char *temp = NULL;
is_internet_available = FALSE;
+ char *saveptr = NULL;
if (NULL != reply) {
if ((NULL != g_strrstr((char*)reply, "HTTP/1.1 200")) &&
} else if (NULL != g_strrstr((char*)reply, "HTTP/1.1 302")) {
DBG("302:: Internet is un-available");
} else if ((temp = g_strrstr((char*)reply, "Location:")) != NULL) {
- char * location = strtok(temp, "\r");
+ char * location = strtok_r(temp, "\r", &saveptr);
if (location != NULL) {
DBG("%s", location);
if (redirect_url1 == NULL)
{
DBG("Timer timed-out");
enum netconfig_internet_check_state prev_state = (enum netconfig_internet_check_state)GPOINTER_TO_INT(data);
- INFO("Prev_state: state=%d (1:dns check / 2:packet check)",prev_state);
+ INFO("Prev_state: state=%d (1:dns check / 2:packet check)", prev_state);
if (net_params == NULL)
return FALSE;
if (net_params->header_done == TRUE)
return FALSE;
- n = send(fd, request_data, strlen(request_data), 0);
+ n = send(fd, request_data, strlen(request_data), MSG_NOSIGNAL);
DBG("Sent %d bytes", n);
if (n < 0) {
__internet_check_state(INTERNET_CHECK_STATE_PACKET_CHECK);
return;
- cleanup:
+cleanup:
__internet_check_state(INTERNET_CHECK_STATE_NONE);
}
list = g_resolver_lookup_by_name_finish((GResolver *)src, res, &error);
if (error != NULL) {
- if (error->code == G_IO_ERROR_CANCELLED) {
+ if (error->code == G_IO_ERROR_CANCELLED)
ERR("G_IO_ERROR_CANCELLED is called[%s]", error->message);
- }
g_error_free(error);
}
gboolean __netconfig_obtain_host_ip_addr(void)
{
char *host, *addr, *port;
+ char *saveptr = NULL;
if (net_params == NULL)
return FALSE;
if (host == NULL)
goto cleanup;
- addr = strtok(host, ":");
+ addr = strtok_r(host, ":", &saveptr);
if (addr == NULL)
goto cleanup;
is_internet_available = FALSE;
/* If the host IP is resolved, directly go for connecting to sockets*/
- if (__netconfig_obtain_host_ip_addr() == TRUE) {
+ if (__netconfig_obtain_host_ip_addr() == TRUE)
__netconfig_connect_sockets();
- }
}
void netconfig_stop_internet_check(void)