summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2019-01-01 19:23:14 -0500
committerJason Woodward2019-01-01 19:23:14 -0500
commit47d9e9e737997b7bb4c0e8143a80fdefc6cb6005 (patch)
treec3114cc9abecc17abb79b74efc6342d52878674c
parent5e9b5dfe3cd422f1484dbcaf6fb1e8031cd28f93 (diff)
downloadslapt-get-curl_off_t.tar.gz
switch to CURLINFO_FILETIME_Tcurl_off_t
-rw-r--r--src/curl.c8
-rw-r--r--src/curl.h9
2 files changed, 14 insertions, 3 deletions
diff --git a/src/curl.c b/src/curl.c
index 544ce23..d3053f8 100644
--- a/src/curl.c
+++ b/src/curl.c
@@ -25,7 +25,7 @@ struct head_data_t {
size_t size;
};
-int slapt_download_data(FILE *fh, const char *url, size_t bytes, long *filetime,
+int slapt_download_data(FILE *fh, const char *url, size_t bytes, SLAPT_DOWNLOAD_FILE_TIME_T *filetime,
const slapt_rc_config *global_config)
{
CURL *ch = NULL;
@@ -83,7 +83,11 @@ int slapt_download_data(FILE *fh, const char *url, size_t bytes, long *filetime,
/* XXX Use CURLINFO_FILETIME_T with 7.59+ */
if (filetime != NULL)
+#ifdef CURLINFO_FILETIME_T
+ curl_easy_getinfo(ch, CURLINFO_FILETIME_T, filetime);
+#else
curl_easy_getinfo(ch, CURLINFO_FILETIME, filetime);
+#endif
/*
need to use curl_easy_cleanup() so that we don't
@@ -199,7 +203,7 @@ const char *slapt_download_pkg(const slapt_rc_config *global_config,
slapt_code_t verify = SLAPT_OK;
int dl_return = -1, dl_total_size = 0;
bool is_interactive = slapt_is_interactive(global_config);
- long filetime = 0;
+ SLAPT_DOWNLOAD_FILE_TIME_T filetime = 0;
if (pkg == NULL) {
fprintf(stderr, "slapt_download_pkg() called without a package!\n");
diff --git a/src/curl.h b/src/curl.h
index 70c44f1..11ecc8d 100644
--- a/src/curl.h
+++ b/src/curl.h
@@ -18,11 +18,18 @@
#define SLAPT_NO_SSL_VERIFYPEER "SLAPT_NO_SSL_VERIFYPEER"
+#include <curl/curl.h>
+#ifdef CURLINFO_FILETIME_T
+ typedef curl_off_t SLAPT_DOWNLOAD_FILE_TIME_T;
+#else
+ typedef long SLAPT_DOWNLOAD_FILE_TIME_T;
+#endif
+
/*
download data to file, resuming from bytes and preserving filetime.
returns curl code
*/
-int slapt_download_data(FILE *fh, const char *url, size_t bytes, long *filetime,
+int slapt_download_data(FILE *fh, const char *url, size_t bytes, SLAPT_DOWNLOAD_FILE_TIME_T *filetime,
const slapt_rc_config *global_config);
/*