Skip to content

Commit 2f5cf96

Browse files
committed
fix: printing of error string.
1 parent 7143d9f commit 2f5cf96

2 files changed

Lines changed: 41 additions & 41 deletions

File tree

src/link.c

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -96,46 +96,46 @@ static CURL *Link_to_curl(Link *link)
9696
*/
9797
CURLcode ret = curl_easy_setopt(curl, CURLOPT_USERAGENT, CONFIG.user_agent);
9898
if (ret) {
99-
lprintf(error, "%s", curl_easy_strerror(ret));
99+
lprintf(error, "%s\n", curl_easy_strerror(ret));
100100
}
101101
ret = curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
102102
if (ret) {
103-
lprintf(error, "%s", curl_easy_strerror(ret));
103+
lprintf(error, "%s\n", curl_easy_strerror(ret));
104104
}
105105
/*
106106
* for following directories without the '/'
107107
*/
108108
ret = curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 2);
109109
if (ret) {
110-
lprintf(error, "%s", curl_easy_strerror(ret));
110+
lprintf(error, "%s\n", curl_easy_strerror(ret));
111111
}
112112
ret = curl_easy_setopt(curl, CURLOPT_URL, link->f_url);
113113
if (ret) {
114-
lprintf(error, "%s", curl_easy_strerror(ret));
114+
lprintf(error, "%s\n", curl_easy_strerror(ret));
115115
}
116116
ret = curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1);
117117
if (ret) {
118-
lprintf(error, "%s", curl_easy_strerror(ret));
118+
lprintf(error, "%s\n", curl_easy_strerror(ret));
119119
}
120120
ret = curl_easy_setopt(curl, CURLOPT_PIPEWAIT, 1L);
121121
if (ret) {
122-
lprintf(error, "%s", curl_easy_strerror(ret));
122+
lprintf(error, "%s\n", curl_easy_strerror(ret));
123123
}
124124
ret = curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_3);
125125
if (ret) {
126-
lprintf(error, "%s", curl_easy_strerror(ret));
126+
lprintf(error, "%s\n", curl_easy_strerror(ret));
127127
}
128128
ret = curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 15);
129129
if (ret) {
130-
lprintf(error, "%s", curl_easy_strerror(ret));
130+
lprintf(error, "%s\n", curl_easy_strerror(ret));
131131
}
132132
ret = curl_easy_setopt(curl, CURLOPT_SHARE, CURL_SHARE);
133133
if (ret) {
134-
lprintf(error, "%s", curl_easy_strerror(ret));
134+
lprintf(error, "%s\n", curl_easy_strerror(ret));
135135
}
136136
ret = curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_memory_callback);
137137
if (ret) {
138-
lprintf(error, "%s", curl_easy_strerror(ret));
138+
lprintf(error, "%s\n", curl_easy_strerror(ret));
139139
}
140140
if (CONFIG.cafile || CONFIG.capath) {
141141
/*
@@ -145,82 +145,82 @@ static CURL *Link_to_curl(Link *link)
145145
*/
146146
ret = curl_easy_setopt(curl, CURLOPT_CAPATH, CONFIG.capath);
147147
if (ret) {
148-
lprintf(error, "%s", curl_easy_strerror(ret));
148+
lprintf(error, "%s\n", curl_easy_strerror(ret));
149149
}
150150

151151
ret = curl_easy_setopt(curl, CURLOPT_CAINFO, CONFIG.cafile);
152152
if (ret) {
153-
lprintf(error, "%s", curl_easy_strerror(ret));
153+
lprintf(error, "%s\n", curl_easy_strerror(ret));
154154
}
155155
}
156156
if (CONFIG.insecure_tls) {
157157
ret = curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
158158
if (ret) {
159-
lprintf(error, "%s", curl_easy_strerror(ret));
159+
lprintf(error, "%s\n", curl_easy_strerror(ret));
160160
}
161161
}
162162

163163
if (CONFIG.log_type & libcurl_debug) {
164164
ret = curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
165165
if (ret) {
166-
lprintf(error, "%s", curl_easy_strerror(ret));
166+
lprintf(error, "%s\n", curl_easy_strerror(ret));
167167
}
168168
}
169169

170170
if (CONFIG.http_headers) {
171171
ret = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, CONFIG.http_headers);
172172
if (ret) {
173-
lprintf(error, "%s", curl_easy_strerror(ret));
173+
lprintf(error, "%s\n", curl_easy_strerror(ret));
174174
}
175175
}
176176

177177
if (CONFIG.http_username) {
178178
ret = curl_easy_setopt(curl, CURLOPT_USERNAME, CONFIG.http_username);
179179
if (ret) {
180-
lprintf(error, "%s", curl_easy_strerror(ret));
180+
lprintf(error, "%s\n", curl_easy_strerror(ret));
181181
}
182182
}
183183

184184
if (CONFIG.http_password) {
185185
ret = curl_easy_setopt(curl, CURLOPT_PASSWORD, CONFIG.http_password);
186186
if (ret) {
187-
lprintf(error, "%s", curl_easy_strerror(ret));
187+
lprintf(error, "%s\n", curl_easy_strerror(ret));
188188
}
189189
}
190190

191191
if (CONFIG.proxy) {
192192
ret = curl_easy_setopt(curl, CURLOPT_PROXY, CONFIG.proxy);
193193
if (ret) {
194-
lprintf(error, "%s", curl_easy_strerror(ret));
194+
lprintf(error, "%s\n", curl_easy_strerror(ret));
195195
}
196196
}
197197

198198
if (CONFIG.proxy_username) {
199199
ret = curl_easy_setopt(curl, CURLOPT_PROXYUSERNAME,
200200
CONFIG.proxy_username);
201201
if (ret) {
202-
lprintf(error, "%s", curl_easy_strerror(ret));
202+
lprintf(error, "%s\n", curl_easy_strerror(ret));
203203
}
204204
}
205205

206206
if (CONFIG.proxy_password) {
207207
ret = curl_easy_setopt(curl, CURLOPT_PROXYPASSWORD,
208208
CONFIG.proxy_password);
209209
if (ret) {
210-
lprintf(error, "%s", curl_easy_strerror(ret));
210+
lprintf(error, "%s\n", curl_easy_strerror(ret));
211211
}
212212
}
213213

214214
if (CONFIG.proxy_cafile || CONFIG.proxy_capath) {
215215
/* See CONFIG.cafile above */
216216
ret = curl_easy_setopt(curl, CURLOPT_PROXY_CAPATH, CONFIG.proxy_capath);
217217
if (ret) {
218-
lprintf(error, "%s", curl_easy_strerror(ret));
218+
lprintf(error, "%s\n", curl_easy_strerror(ret));
219219
}
220220

221221
ret = curl_easy_setopt(curl, CURLOPT_PROXY_CAINFO, CONFIG.proxy_cafile);
222222
if (ret) {
223-
lprintf(error, "%s", curl_easy_strerror(ret));
223+
lprintf(error, "%s\n", curl_easy_strerror(ret));
224224
}
225225
}
226226

@@ -232,11 +232,11 @@ static void Link_req_file_stat(Link *this_link)
232232
CURL *curl = Link_to_curl(this_link);
233233
CURLcode ret = curl_easy_setopt(curl, CURLOPT_NOBODY, 1L);
234234
if (ret) {
235-
lprintf(error, "%s", curl_easy_strerror(ret));
235+
lprintf(error, "%s\n", curl_easy_strerror(ret));
236236
}
237237
ret = curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
238238
if (ret) {
239-
lprintf(error, "%s", curl_easy_strerror(ret));
239+
lprintf(error, "%s\n", curl_easy_strerror(ret));
240240
}
241241

242242
/*
@@ -251,7 +251,7 @@ static void Link_req_file_stat(Link *this_link)
251251
transfer->type = FILESTAT;
252252
ret = curl_easy_setopt(curl, CURLOPT_PRIVATE, transfer);
253253
if (ret) {
254-
lprintf(error, "%s", curl_easy_strerror(ret));
254+
lprintf(error, "%s\n", curl_easy_strerror(ret));
255255
}
256256

257257
transfer_nonblocking(curl);
@@ -635,17 +635,17 @@ void Link_set_file_stat(Link *this_link, CURL *curl)
635635
long http_resp;
636636
CURLcode ret = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_resp);
637637
if (ret) {
638-
lprintf(error, "%s", curl_easy_strerror(ret));
638+
lprintf(error, "%s\n", curl_easy_strerror(ret));
639639
}
640640
if (http_resp == HTTP_OK) {
641641
curl_off_t cl = 0;
642642
ret = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &cl);
643643
if (ret) {
644-
lprintf(error, "%s", curl_easy_strerror(ret));
644+
lprintf(error, "%s\n", curl_easy_strerror(ret));
645645
}
646646
ret = curl_easy_getinfo(curl, CURLINFO_FILETIME, &(this_link->time));
647647
if (ret) {
648-
lprintf(error, "%s", curl_easy_strerror(ret));
648+
lprintf(error, "%s\n", curl_easy_strerror(ret));
649649
}
650650

651651
if (this_link->type == LINK_UNINITIALISED_FILE) {
@@ -1267,11 +1267,11 @@ TransferStruct Link_download_full(Link *link)
12671267

12681268
CURLcode ret = curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&ts);
12691269
if (ret) {
1270-
lprintf(error, "%s", curl_easy_strerror(ret));
1270+
lprintf(error, "%s\n", curl_easy_strerror(ret));
12711271
}
12721272
ret = curl_easy_setopt(curl, CURLOPT_PRIVATE, (void *)&ts);
12731273
if (ret) {
1274-
lprintf(error, "%s", curl_easy_strerror(ret));
1274+
lprintf(error, "%s\n", curl_easy_strerror(ret));
12751275
}
12761276

12771277
/*
@@ -1290,7 +1290,7 @@ TransferStruct Link_download_full(Link *link)
12901290
transfer_blocking(curl);
12911291
ret = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_resp);
12921292
if (ret) {
1293-
lprintf(error, "%s", curl_easy_strerror(ret));
1293+
lprintf(error, "%s\n", curl_easy_strerror(ret));
12941294
}
12951295
if (HTTP_temp_failure(http_resp)) {
12961296
lprintf(warning, "URL: %s, HTTP %ld, retrying later.\n", url,
@@ -1308,7 +1308,7 @@ TransferStruct Link_download_full(Link *link)
13081308

13091309
ret = curl_easy_getinfo(curl, CURLINFO_FILETIME, &(link->time));
13101310
if (ret) {
1311-
lprintf(error, "%s", curl_easy_strerror(ret));
1311+
lprintf(error, "%s\n", curl_easy_strerror(ret));
13121312
}
13131313
curl_easy_cleanup(curl);
13141314
return ts;
@@ -1330,19 +1330,19 @@ static CURL *Link_download_curl_setup(Link *link, size_t req_size, off_t offset,
13301330
CURL *curl = Link_to_curl(link);
13311331
CURLcode ret = curl_easy_setopt(curl, CURLOPT_HEADERDATA, (void *)header);
13321332
if (ret) {
1333-
lprintf(error, "%s", curl_easy_strerror(ret));
1333+
lprintf(error, "%s\n", curl_easy_strerror(ret));
13341334
}
13351335
ret = curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)ts);
13361336
if (ret) {
1337-
lprintf(error, "%s", curl_easy_strerror(ret));
1337+
lprintf(error, "%s\n", curl_easy_strerror(ret));
13381338
}
13391339
ret = curl_easy_setopt(curl, CURLOPT_PRIVATE, (void *)ts);
13401340
if (ret) {
1341-
lprintf(error, "%s", curl_easy_strerror(ret));
1341+
lprintf(error, "%s\n", curl_easy_strerror(ret));
13421342
}
13431343
ret = curl_easy_setopt(curl, CURLOPT_RANGE, range_str);
13441344
if (ret) {
1345-
lprintf(error, "%s", curl_easy_strerror(ret));
1345+
lprintf(error, "%s\n", curl_easy_strerror(ret));
13461346
}
13471347

13481348
return curl;
@@ -1369,14 +1369,14 @@ bug report, please include the following HTTP header information:\n%s\n",
13691369
long http_resp;
13701370
CURLcode ret = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_resp);
13711371
if (ret) {
1372-
lprintf(error, "%s", curl_easy_strerror(ret));
1372+
lprintf(error, "%s\n", curl_easy_strerror(ret));
13731373
}
13741374
curl_off_t recv = -1;
13751375
if ((http_resp == HTTP_OK) || (http_resp == HTTP_PARTIAL_CONTENT)
13761376
|| (http_resp == HTTP_RANGE_NOT_SATISFIABLE)) {
13771377
ret = curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD_T, &recv);
13781378
if (ret) {
1379-
lprintf(error, "%s", curl_easy_strerror(ret));
1379+
lprintf(error, "%s\n", curl_easy_strerror(ret));
13801380
}
13811381
} else {
13821382
char *url;

src/network.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,13 @@ static void curl_process_msgs(CURLMsg *curl_msg, int n_running_curl,
145145
CURLcode ret
146146
= curl_easy_getinfo(curl_msg->easy_handle, CURLINFO_PRIVATE, &ts);
147147
if (ret) {
148-
lprintf(error, "%s", curl_easy_strerror(ret));
148+
lprintf(error, "%s\n", curl_easy_strerror(ret));
149149
}
150150
ts->transferring = 0;
151151
char *url = NULL;
152152
ret = curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url);
153153
if (ret) {
154-
lprintf(error, "%s", curl_easy_strerror(ret));
154+
lprintf(error, "%s\n", curl_easy_strerror(ret));
155155
}
156156

157157
if (!curl_msg->data.result) {
@@ -283,7 +283,7 @@ void transfer_blocking(CURL *curl)
283283
TransferStruct *ts;
284284
CURLcode ret = curl_easy_getinfo(curl, CURLINFO_PRIVATE, &ts);
285285
if (ret) {
286-
lprintf(error, "%s", curl_easy_strerror(ret));
286+
lprintf(error, "%s\n", curl_easy_strerror(ret));
287287
}
288288

289289
lprintf(network_lock_debug, "thread %lx: locking transfer_lock;\n",

0 commit comments

Comments
 (0)