On Tue, Jan 26, 2010 at 03:20:00AM +0100, Matthias Bolte wrote:
---
src/esx/esx_vi.c | 14 ++++++++------
src/esx/esx_vi.h | 1 +
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index 0fe9535..bc94326 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -251,8 +251,8 @@ esxVI_CURL_Perform(esxVI_Context *ctx, const char *url)
if (errorCode != CURLE_OK) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "curl_easy_perform() returned an error: %s (%d)",
- curl_easy_strerror(errorCode), errorCode);
+ "curl_easy_perform() returned an error: %s (%d) : %s",
+ curl_easy_strerror(errorCode), errorCode, ctx->curl_error);
return -1;
}
@@ -262,8 +262,8 @@ esxVI_CURL_Perform(esxVI_Context *ctx, const char *url)
if (errorCode != CURLE_OK) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"curl_easy_getinfo(CURLINFO_RESPONSE_CODE) returned an "
- "error: %s (%d)", curl_easy_strerror(errorCode),
- errorCode);
+ "error: %s (%d) : %s", curl_easy_strerror(errorCode),
+ errorCode, ctx->curl_error);
return -1;
}
@@ -282,8 +282,8 @@ esxVI_CURL_Perform(esxVI_Context *ctx, const char *url)
if (errorCode != CURLE_OK) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"curl_easy_getinfo(CURLINFO_REDIRECT_URL) returned "
- "an error: %s (%d)", curl_easy_strerror(errorCode),
- errorCode);
+ "an error: %s (%d) : %s",
curl_easy_strerror(errorCode),
+ errorCode, ctx->curl_error);
} else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"The server redirects from '%s' to
'%s'", url,
@@ -360,6 +360,8 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
esxVI_CURL_ReadString);
curl_easy_setopt(ctx->curl_handle, CURLOPT_WRITEFUNCTION,
esxVI_CURL_WriteBuffer);
+ curl_easy_setopt(ctx->curl_handle, CURLOPT_ERRORBUFFER,
+ ctx->curl_error);
#if ESX_VI__CURL__ENABLE_DEBUG_OUTPUT
curl_easy_setopt(ctx->curl_handle, CURLOPT_DEBUGFUNCTION, esxVI_CURL_Debug);
curl_easy_setopt(ctx->curl_handle, CURLOPT_VERBOSE, 1);
diff --git a/src/esx/esx_vi.h b/src/esx/esx_vi.h
index 608dcbd..4e8b675 100644
--- a/src/esx/esx_vi.h
+++ b/src/esx/esx_vi.h
@@ -77,6 +77,7 @@ struct _esxVI_Context {
char *ipAddress;
CURL *curl_handle;
struct curl_slist *curl_headers;
+ char curl_error[CURL_ERROR_SIZE];
virMutex curl_lock;
char *username;
char *password;
--
ACK
Daniel
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://ovirt.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|