diff options
author | Daniel Stenberg <daniel@haxx.se> | 2010-09-06 00:02:54 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2010-09-06 00:02:54 +0200 |
commit | c6fa1952a14ba2fa14f4a3483f1f573560ef3133 (patch) | |
tree | 08c88f75e74eb8e8f969234000579e25e76584f2 /lib/getinfo.c | |
parent | d47bd396cecd755c5f88d1e0c7b82a81bca8bd83 (diff) | |
download | curl-c6fa1952a14ba2fa14f4a3483f1f573560ef3133.tar.gz |
portabilty: use proper variable type to hold sockets
Curl_getconnectinfo() is changed to return a proper curl_socket_t for
the last socket so that it'll work more portably (and cause less
compiler warnings).
Diffstat (limited to 'lib/getinfo.c')
-rw-r--r-- | lib/getinfo.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/getinfo.c b/lib/getinfo.c index d5517e489..c00e675eb 100644 --- a/lib/getinfo.c +++ b/lib/getinfo.c @@ -83,6 +83,7 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...) char **param_charp=NULL; struct curl_slist **param_slistp=NULL; int type; + curl_socket_t sockfd; union { struct curl_certinfo * to_certinfo; @@ -219,7 +220,16 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...) *param_charp = data->state.most_recent_ftp_entrypath; break; case CURLINFO_LASTSOCKET: - (void)Curl_getconnectinfo(data, param_longp, NULL); + sockfd = Curl_getconnectinfo(data, NULL); + + /* note: this is not a good conversion for systems with 64 bit sockets and + 32 bit longs */ + if(sockfd != CURL_SOCKET_BAD) + *param_longp = (long)sockfd; + else + /* this interface is documented to return -1 in case of badness, which + may not be the same as the CURL_SOCKET_BAD value */ + *param_longp = -1; break; case CURLINFO_REDIRECT_URL: /* Return the URL this request would have been redirected to if that |