header = curl_slist_append(header, tmp_header);
g_free(tmp_header);
- curl_easy_setopt(curl, CURLOPT_HTTPHEADER, header);
+ int curl_ret_code = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, header);
+ if (CURLE_OK != curl_ret_code) {
+ _E("curl_easy_setopt: CURLOPT_HTTPHEADER failed!! curl_ret_code[%d]", curl_ret_code);
+ }
}
static size_t __gather_data(void *downloaded_data,
char *tmp_header = NULL;
char *req_url = NULL;
char query[128];
+ int curl_ret_code = 0;
curl = curl_easy_init();
retvm_if(!curl, -EIO, "Failed to init curl");
- curl_easy_setopt(curl, CURLOPT_HTTPGET, 1);
+ curl_ret_code = curl_easy_setopt(curl, CURLOPT_HTTPGET, 1);
+ retvm_if(CURLE_OK != curl_ret_code, -EIO, "Failed to curl_easy_setopt with CURLOPT_HTTPGET : ret_code[%d]", curl_ret_code);
tmp_header = g_strconcat("X-IOT-UID: ", uid, NULL);
header = curl_slist_append(header, tmp_header);
header = curl_slist_append(header, tmp_header);
g_free(tmp_header);
- curl_easy_setopt(curl, CURLOPT_HTTPHEADER, header);
+ curl_ret_code = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, header);
+ retvm_if(CURLE_OK != curl_ret_code, -EIO, "Failed to curl_easy_setopt with CURLOPT_HTTPHEADER : ret_code[%d]", curl_ret_code);
snprintf(query, sizeof(query), "?deviceType=%s¤tVersion=%s", device_type, current_version);
req_url = g_strconcat(STDM_URL, query, NULL);
FILE *fp = NULL;
CURL *curl = NULL;
CURLcode err;
+ int curl_ret_code = 0;
curl = curl_easy_init();
retvm_if(!curl, -EIO, "Failed to init curl");
fp = fopen(download_path, "wb");
- curl_easy_setopt(curl, CURLOPT_URL, download_url);
- curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NULL);
- curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
+ curl_ret_code = curl_easy_setopt(curl, CURLOPT_URL, download_url);
+ retvm_if(CURLE_OK != curl_ret_code, -EIO, "Failed to curl_easy_setopt with CURLOPT_URL : ret_code[%d]", curl_ret_code);
+
+ curl_ret_code = curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NULL);
+ retvm_if(CURLE_OK != curl_ret_code, -EIO, "Failed to curl_easy_setopt with CURLOPT_WRITEFUNCTION : ret_code[%d]", curl_ret_code);
+
+ curl_ret_code = curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
+ retvm_if(CURLE_OK != curl_ret_code, -EIO, "Failed to curl_easy_setopt with CURLOPT_WRITEDATA : ret_code[%d]", curl_ret_code);
err = curl_easy_perform(curl);
GByteArray *response_header = NULL;
GByteArray *response_body= NULL;
CURLcode err;
+ int curl_ret_code = 0;
curl = curl_easy_init();
retvm_if(!curl, -EIO, "Failed to init curl");
__curl_set_request_headers(curl);
if (type == FMWUP_HTTP_GET) {
- curl_easy_setopt(curl, CURLOPT_HTTPGET, 1);
+ curl_ret_code = curl_easy_setopt(curl, CURLOPT_HTTPGET, 1);
+ retvm_if(CURLE_OK != curl_ret_code, -EIO, "Failed to curl_easy_setopt with CURLOPT_HTTPGET : ret_code[%d]", curl_ret_code);
} else if (type == FMWUP_HTTP_POST) {
- curl_easy_setopt(curl, CURLOPT_HTTPPOST, 1);
+ curl_ret_code = curl_easy_setopt(curl, CURLOPT_HTTPPOST, 1);
+ retvm_if(CURLE_OK != curl_ret_code, -EIO, "Failed to curl_easy_setopt with CURLOPT_HTTPPOST : ret_code[%d]", curl_ret_code);
} else {
return -1;
}