if (errno == EAGAIN) {
fd_set writefds;
struct timeval timeout;
+ int result = 0;
FD_ZERO(&writefds);
FD_SET(sockfd, &writefds);
timeout.tv_sec = 1;
timeout.tv_usec = 0;
- ret = select(sockfd + 1, NULL, &writefds, NULL, &timeout);
- if (ret < 0) {
+ result = select(sockfd + 1, NULL, &writefds, NULL, &timeout);
+ if (result < 0) {
LOG_INFO("not possible to send data\n");
+ ret = false;
break;
}
LOG_TRACE("possible to send data\n");
}
}
- if (ret < 0 && ret != -EISCONN) {
+ if (ret < 0) {
if (ret == -ECONNREFUSED) {
LOG_INFO("socket connection is refused\n");
set_tethering_connection_status(CONNREFUSED);
if (!p->buffer) {
LOG_SEVERE("failed to allocate \n");
+ } else {
+ memcpy(p->buffer + p->length, data, len);
+ p->length += len;
}
-
- memcpy(p->buffer + p->length, data, len);
- p->length += len;
}
static void user_flush_data(png_structp png_ptr)
LOG_TRACE("png_create_info_struct\n");
info_ptr = png_create_info_struct(png_ptr);
- if (!png_ptr) {
+ if (!info_ptr) {
LOG_SEVERE("png_create_info_struct failure\n");
g_free(surface);
png_destroy_write_struct(&png_ptr, &info_ptr);