aboutsummaryrefslogtreecommitdiff
path: root/lib/easy.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2007-02-16 18:19:35 +0000
committerYang Tse <yangsita@gmail.com>2007-02-16 18:19:35 +0000
commita1d598399146984c99baa46db148e87c75261033 (patch)
treea2572fd8f9c9f76e746ee04f7fc5dd46f1fe44f9 /lib/easy.c
parent4894ce16fc7af89d876e2f70db4dded7e1663198 (diff)
use macros ERRNO, SET_ERRNO(), SOCKERRNO and SET_SOCKERRNO() for errno handling
Diffstat (limited to 'lib/easy.c')
-rw-r--r--lib/easy.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/easy.c b/lib/easy.c
index 8ac1ba178..1ada99c3d 100644
--- a/lib/easy.c
+++ b/lib/easy.c
@@ -750,17 +750,19 @@ CURLcode Curl_convert_to_network(struct SessionHandle *data,
/* do the translation ourselves */
char *input_ptr, *output_ptr;
size_t in_bytes, out_bytes, rc;
+ int error;
/* open an iconv conversion descriptor if necessary */
if(data->outbound_cd == (iconv_t)-1) {
data->outbound_cd = iconv_open(CURL_ICONV_CODESET_OF_NETWORK,
CURL_ICONV_CODESET_OF_HOST);
if(data->outbound_cd == (iconv_t)-1) {
+ error = ERRNO;
failf(data,
"The iconv_open(\"%s\", \"%s\") call failed with errno %i: %s",
CURL_ICONV_CODESET_OF_NETWORK,
CURL_ICONV_CODESET_OF_HOST,
- errno, strerror(errno));
+ error, strerror(error));
return CURLE_CONV_FAILED;
}
}
@@ -770,9 +772,10 @@ CURLcode Curl_convert_to_network(struct SessionHandle *data,
rc = iconv(data->outbound_cd, (const char**)&input_ptr, &in_bytes,
&output_ptr, &out_bytes);
if ((rc == ICONV_ERROR) || (in_bytes != 0)) {
+ error = ERRNO;
failf(data,
"The Curl_convert_to_network iconv call failed with errno %i: %s",
- errno, strerror(errno));
+ error, strerror(error));
return CURLE_CONV_FAILED;
}
#else
@@ -807,17 +810,19 @@ CURLcode Curl_convert_from_network(struct SessionHandle *data,
/* do the translation ourselves */
char *input_ptr, *output_ptr;
size_t in_bytes, out_bytes, rc;
+ int error;
/* open an iconv conversion descriptor if necessary */
if(data->inbound_cd == (iconv_t)-1) {
data->inbound_cd = iconv_open(CURL_ICONV_CODESET_OF_HOST,
CURL_ICONV_CODESET_OF_NETWORK);
if(data->inbound_cd == (iconv_t)-1) {
+ error = ERRNO;
failf(data,
"The iconv_open(\"%s\", \"%s\") call failed with errno %i: %s",
CURL_ICONV_CODESET_OF_HOST,
CURL_ICONV_CODESET_OF_NETWORK,
- errno, strerror(errno));
+ error, strerror(error));
return CURLE_CONV_FAILED;
}
}
@@ -827,9 +832,10 @@ CURLcode Curl_convert_from_network(struct SessionHandle *data,
rc = iconv(data->inbound_cd, (const char **)&input_ptr, &in_bytes,
&output_ptr, &out_bytes);
if ((rc == ICONV_ERROR) || (in_bytes != 0)) {
+ error = ERRNO;
failf(data,
"The Curl_convert_from_network iconv call failed with errno %i: %s",
- errno, strerror(errno));
+ error, strerror(error));
return CURLE_CONV_FAILED;
}
#else
@@ -864,17 +870,19 @@ CURLcode Curl_convert_from_utf8(struct SessionHandle *data,
/* do the translation ourselves */
char *input_ptr, *output_ptr;
size_t in_bytes, out_bytes, rc;
+ int error;
/* open an iconv conversion descriptor if necessary */
if(data->utf8_cd == (iconv_t)-1) {
data->utf8_cd = iconv_open(CURL_ICONV_CODESET_OF_HOST,
CURL_ICONV_CODESET_FOR_UTF8);
if(data->utf8_cd == (iconv_t)-1) {
+ error = ERRNO;
failf(data,
"The iconv_open(\"%s\", \"%s\") call failed with errno %i: %s",
CURL_ICONV_CODESET_OF_HOST,
CURL_ICONV_CODESET_FOR_UTF8,
- errno, strerror(errno));
+ error, strerror(error));
return CURLE_CONV_FAILED;
}
}
@@ -884,9 +892,10 @@ CURLcode Curl_convert_from_utf8(struct SessionHandle *data,
rc = iconv(data->utf8_cd, (const char**)&input_ptr, &in_bytes,
&output_ptr, &out_bytes);
if ((rc == ICONV_ERROR) || (in_bytes != 0)) {
+ error = ERRNO;
failf(data,
"The Curl_convert_from_utf8 iconv call failed with errno %i: %s",
- errno, strerror(errno));
+ error, strerror(error));
return CURLE_CONV_FAILED;
}
if (output_ptr < input_ptr) {