@@ -306,7 +306,7 @@ static CURLcode pre_transfer(struct GlobalConfig *global,
306
306
if ((per -> infd == -1 ) || fstat (per -> infd , & fileinfo ))
307
307
#endif
308
308
{
309
- helpf (global -> errors , "Can't open '%s'!\n" , per -> uploadfile );
309
+ helpf (stderr , "Can't open '%s'!\n" , per -> uploadfile );
310
310
if (per -> infd != -1 ) {
311
311
close (per -> infd );
312
312
per -> infd = STDIN_FILENO ;
@@ -404,18 +404,18 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
404
404
if (!config -> synthetic_error && result &&
405
405
(!global -> silent || global -> showerror )) {
406
406
const char * msg = per -> errorbuffer ;
407
- fprintf (global -> errors , "curl: (%d) %s\n" , result ,
407
+ fprintf (stderr , "curl: (%d) %s\n" , result ,
408
408
(msg && msg [0 ]) ? msg : curl_easy_strerror (result ));
409
409
if (result == CURLE_PEER_FAILED_VERIFICATION )
410
- fputs (CURL_CA_CERT_ERRORMSG , global -> errors );
410
+ fputs (CURL_CA_CERT_ERRORMSG , stderr );
411
411
}
412
412
else if (config -> failwithbody ) {
413
413
/* if HTTP response >= 400, return error */
414
414
long code = 0 ;
415
415
curl_easy_getinfo (curl , CURLINFO_RESPONSE_CODE , & code );
416
416
if (code >= 400 ) {
417
417
if (!global -> silent || global -> showerror )
418
- fprintf (global -> errors ,
418
+ fprintf (stderr ,
419
419
"curl: (%d) The requested URL returned error: %ld\n" ,
420
420
CURLE_HTTP_RETURNED_ERROR , code );
421
421
result = CURLE_HTTP_RETURNED_ERROR ;
@@ -448,7 +448,7 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
448
448
/* something went wrong in the writing process */
449
449
result = CURLE_WRITE_ERROR ;
450
450
if (!global -> silent || global -> showerror )
451
- fprintf (global -> errors , "curl: (%d) Failed writing body\n" , result );
451
+ fprintf (stderr , "curl: (%d) Failed writing body\n" , result );
452
452
}
453
453
}
454
454
@@ -589,8 +589,7 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
589
589
/* We have written data to an output file, we truncate file
590
590
*/
591
591
if (!global -> silent )
592
- fprintf (global -> errors , "Throwing away %"
593
- CURL_FORMAT_CURL_OFF_T " bytes\n" ,
592
+ fprintf (stderr , "Throwing away %" CURL_FORMAT_CURL_OFF_T " bytes\n" ,
594
593
outs -> bytes );
595
594
fflush (outs -> stream );
596
595
/* truncate file at the position where we started appending */
@@ -599,8 +598,7 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
599
598
/* when truncate fails, we can't just append as then we'll
600
599
create something strange, bail out */
601
600
if (!global -> silent || global -> showerror )
602
- fprintf (global -> errors ,
603
- "curl: (23) Failed to truncate file\n" );
601
+ fprintf (stderr , "curl: (23) Failed to truncate file\n" );
604
602
return CURLE_WRITE_ERROR ;
605
603
}
606
604
/* now seek to the end of the file, the position where we
@@ -615,8 +613,7 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
615
613
#endif
616
614
if (rc ) {
617
615
if (!global -> silent || global -> showerror )
618
- fprintf (global -> errors ,
619
- "curl: (23) Failed seeking to end of file\n" );
616
+ fprintf (stderr , "curl: (23) Failed seeking to end of file\n" );
620
617
return CURLE_WRITE_ERROR ;
621
618
}
622
619
outs -> bytes = 0 ; /* clear for next round */
@@ -641,7 +638,7 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
641
638
/* something went wrong in the writing process */
642
639
result = CURLE_WRITE_ERROR ;
643
640
if (!global -> silent || global -> showerror )
644
- fprintf (global -> errors , "curl: (%d) Failed writing body\n" , result );
641
+ fprintf (stderr , "curl: (%d) Failed writing body\n" , result );
645
642
}
646
643
if (result && config -> rm_partial ) {
647
644
notef (global , "Removing output file: %s\n" , outs -> filename );
@@ -801,7 +798,7 @@ static CURLcode single_transfer(struct GlobalConfig *global,
801
798
/* Unless explicitly shut off */
802
799
result = glob_url (& inglob , infiles , & state -> infilenum ,
803
800
(!global -> silent || global -> showerror )?
804
- global -> errors :NULL );
801
+ stderr :NULL );
805
802
if (result )
806
803
break ;
807
804
config -> state .inglob = inglob ;
@@ -837,7 +834,7 @@ static CURLcode single_transfer(struct GlobalConfig *global,
837
834
expressions and return total number of URLs in pattern set */
838
835
result = glob_url (& state -> urls , urlnode -> url , & state -> urlnum ,
839
836
(!global -> silent || global -> showerror )?
840
- global -> errors :NULL );
837
+ stderr :NULL );
841
838
if (result )
842
839
break ;
843
840
urlnum = state -> urlnum ;
@@ -1096,7 +1093,7 @@ static CURLcode single_transfer(struct GlobalConfig *global,
1096
1093
file output call */
1097
1094
1098
1095
if (config -> create_dirs ) {
1099
- result = create_dir_hierarchy (per -> outfile , global -> errors );
1096
+ result = create_dir_hierarchy (per -> outfile , stderr );
1100
1097
/* create_dir_hierarchy shows error upon CURLE_WRITE_ERROR */
1101
1098
if (result )
1102
1099
break ;
@@ -1240,9 +1237,6 @@ static CURLcode single_transfer(struct GlobalConfig *global,
1240
1237
}
1241
1238
}
1242
1239
1243
- if (!global -> errors )
1244
- global -> errors = stderr ;
1245
-
1246
1240
if ((!per -> outfile || !strcmp (per -> outfile , "-" )) &&
1247
1241
!config -> use_ascii ) {
1248
1242
/* We get the output to stdout and we have not got the ASCII/text
@@ -1851,7 +1845,7 @@ static CURLcode single_transfer(struct GlobalConfig *global,
1851
1845
my_setopt (curl , CURLOPT_TIMEVALUE_LARGE , config -> condtime );
1852
1846
my_setopt_str (curl , CURLOPT_CUSTOMREQUEST , config -> customrequest );
1853
1847
customrequest_helper (config , config -> httpreq , config -> customrequest );
1854
- my_setopt (curl , CURLOPT_STDERR , global -> errors );
1848
+ my_setopt (curl , CURLOPT_STDERR , stderr );
1855
1849
1856
1850
/* three new ones in libcurl 7.3: */
1857
1851
my_setopt_str (curl , CURLOPT_INTERFACE , config -> iface );
@@ -2517,8 +2511,7 @@ static CURLcode transfer_per_config(struct GlobalConfig *global,
2517
2511
2518
2512
/* Check we have a url */
2519
2513
if (!config -> url_list || !config -> url_list -> url ) {
2520
- helpf (global -> errors , "(%d) no URL specified!\n" ,
2521
- CURLE_FAILED_INIT );
2514
+ helpf (stderr , "(%d) no URL specified!\n" , CURLE_FAILED_INIT );
2522
2515
return CURLE_FAILED_INIT ;
2523
2516
}
2524
2517
@@ -2576,7 +2569,7 @@ static CURLcode transfer_per_config(struct GlobalConfig *global,
2576
2569
if (!config -> capath ) {
2577
2570
curl_free (env );
2578
2571
curl_easy_cleanup (curltls );
2579
- helpf (global -> errors , "out of memory\n" );
2572
+ helpf (stderr , "out of memory\n" );
2580
2573
return CURLE_OUT_OF_MEMORY ;
2581
2574
}
2582
2575
capath_from_env = true;
@@ -2694,7 +2687,7 @@ CURLcode operate(struct GlobalConfig *global, int argc, argv_item_t argv[])
2694
2687
2695
2688
/* If we had no arguments then make sure a url was specified in .curlrc */
2696
2689
if ((argc < 2 ) && (!global -> first -> url_list )) {
2697
- helpf (global -> errors , NULL );
2690
+ helpf (stderr , NULL );
2698
2691
result = CURLE_FAILED_INIT ;
2699
2692
}
2700
2693
}
0 commit comments