summaryrefslogtreecommitdiff
path: root/src/agent/download-agent-basic.c
diff options
context:
space:
mode:
authorBang Kwang min <justine.bang@samsung.com>2012-08-27 17:49:37 +0900
committerBang Kwang min <justine.bang@samsung.com>2012-08-27 17:49:37 +0900
commite710e60a94ac9960f28cad4a46e658047cd60eb6 (patch)
treeda85a8d0bfcde19df987d01ab80a524d97d5682a /src/agent/download-agent-basic.c
parentb1669907025392712c82b95fb42ff4fa3d932464 (diff)
downloaddownload-provider-e710e60a94ac9960f28cad4a46e658047cd60eb6.tar.gz
download-provider-e710e60a94ac9960f28cad4a46e658047cd60eb6.tar.bz2
download-provider-e710e60a94ac9960f28cad4a46e658047cd60eb6.zip
Code Sync with Private GIT
changes ) Change the ownership of downloaded file Add detached option when pthread is created fix the failure getting history info from database Resolve prevent defects for agent module divide log level fix the crash by double free fix wrong checking of network status fix first timeout takes a long time
Diffstat (limited to 'src/agent/download-agent-basic.c')
-rw-r--r--src/agent/download-agent-basic.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/agent/download-agent-basic.c b/src/agent/download-agent-basic.c
index db40f45..d069e7e 100644
--- a/src/agent/download-agent-basic.c
+++ b/src/agent/download-agent-basic.c
@@ -64,6 +64,7 @@ da_result_t start_download_with_extension(
client_input_t *client_input = DA_NULL;
client_input_basic_t *client_input_basic = DA_NULL;
download_thread_input *thread_info = DA_NULL;
+ pthread_attr_t thread_attr;
DA_LOG_FUNC_START(Default);
@@ -132,7 +133,7 @@ da_result_t start_download_with_extension(
}
thread_info = (download_thread_input *)calloc(1, sizeof(download_thread_input));
- if(!thread_info) {
+ if (!thread_info) {
DA_LOG_ERR(Default, "DA_ERR_FAIL_TO_MEMALLOC");
ret = DA_ERR_FAIL_TO_MEMALLOC;
goto ERR;
@@ -140,8 +141,18 @@ da_result_t start_download_with_extension(
thread_info->download_id = download_id;
thread_info->client_input = client_input;
}
+ if (pthread_attr_init(&thread_attr) != 0) {
+ ret = DA_ERR_FAIL_TO_CREATE_THREAD;
+ goto ERR;
+ }
+
+ if (pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED) != 0) {
+ ret = DA_ERR_FAIL_TO_CREATE_THREAD;
+ goto ERR;
+ }
- if(pthread_create(&GET_DL_THREAD_ID(download_id), DA_NULL, __thread_start_download, thread_info) < 0) {
+ if (pthread_create(&GET_DL_THREAD_ID(download_id), &thread_attr,
+ __thread_start_download, thread_info) < 0) {
DA_LOG_ERR(Thread, "making thread failed..");
ret = DA_ERR_FAIL_TO_CREATE_THREAD;
} else {