1CURLINFO_OS_ERRNO(3) curl_easy_getinfo options CURLINFO_OS_ERRNO(3)
2
3
4
6 CURLINFO_OS_ERRNO - get errno number from last connect failure
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_OS_ERRNO, long *er‐
12 rnop);
13
15 Pass a pointer to a long to receive the errno variable from a connect
16 failure. Note that the value is only set on failure, it is not reset
17 upon a successful operation. The number is OS and system specific.
18
20 All
21
23 CURL *curl = curl_easy_init();
24 if(curl) {
25 CURLcode res;
26 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
27 res = curl_easy_perform(curl);
28 if(res != CURLE_OK) {
29 long error;
30 res = curl_easy_getinfo(curl, CURLINFO_OS_ERRNO, &error);
31 if(res && error) {
32 printf("Errno: %ld\n", error);
33 }
34 }
35 curl_easy_cleanup(curl);
36 }
37
39 Added in 7.12.2
40
42 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
43 if not.
44
46 curl_easy_getinfo(3), curl_easy_setopt(3),
47
48
49
50libcurl 7.79.1 November 04, 2020 CURLINFO_OS_ERRNO(3)