}
}
}
-#if 0
+
static void
_cbhm_remove_mime_type(Cbhm_Data_Offer *cbhm_data_offer, const char *type)
{
LIST_DEL(&mime->item_link);
free(mime);
DBG("[CBHM]_cbhm_remove_mime_type: remove mime type : %s\n", type);
+ cbhm_data_offer->type_count--;
break;
}
}
}
-#endif
+
static void
_cbhm_free_mime_type_list(Cbhm_Data_Offer *cbhm_data_offer)
{
char buffer[255];
int len, old_len, retry_cnt = 0;
void *data;
+ bool pipe_failed = false;
if (!info) return;
if (!info->data_device_mgr) return;
len = read(info->datafd.fd, buffer, sizeof(buffer));
if (len == -1) {
if (errno == EINTR || errno == EAGAIN) {
+ retry_cnt++;
+ if (retry_cnt > PIPE_RETRY_MAX) {
+ ERR("[CBHM] read fail. retry_cnt over %d. break (%d) %m\n", PIPE_RETRY_MAX, errno);
+ free(received_data);
+ pipe_failed = true;
+ goto receive_data_done;
+ }
continue;
} else {
ERR("[CBHM]_cbhm_receive_data: read fail.(%d) %m\n", errno);
free(received_data);
+ pipe_failed = true;
goto receive_data_done;
}
} else if (len == 0) {
close(info->datafd.fd);
info->datafd.fd = -1;
+ if (pipe_failed)
+ _cbhm_remove_mime_type(info->cbhm_data_offer, info->temp_mime_type);
+
free(info->temp_mime_type);
info->temp_mime_type = NULL;