From 1a43f79547d26d8b19546199fb27abb85183caa3 Mon Sep 17 00:00:00 2001 From: ckolivas Date: Sun, 1 Jul 2012 12:02:10 +1000 Subject: [PATCH] Mingw doesn't support asprintf, use sprintf. --- util.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/util.c b/util.c index 923bb823..b17eceae 100644 --- a/util.c +++ b/util.c @@ -256,10 +256,10 @@ json_t *json_rpc_call(CURL *curl, const char *url, bool probe, bool longpoll, int *rolltime, struct pool *pool, bool share) { - char len_hdr[64], user_agent_hdr[128], *ghashrate; long timeout = longpoll ? (60 * 60) : 60; struct data_buffer all_data = {NULL, 0}; struct header_info hi = {NULL, 0, NULL}; + char len_hdr[64], user_agent_hdr[128]; char curl_err_str[CURL_ERROR_SIZE]; struct curl_slist *headers = NULL; struct upload_buffer upload_data; @@ -326,9 +326,11 @@ json_t *json_rpc_call(CURL *curl, const char *url, headers = curl_slist_append(headers, "X-Mining-Extensions: longpoll midstate rollntime submitold"); - if (likely(global_hashrate && asprintf(&ghashrate, "X-Mining-Hashrate: %llu", global_hashrate) != -1)) { + if (likely(global_hashrate)) { + char ghashrate[255]; + + sprintf(ghashrate, "X-Mining-Hashrate: %llu", global_hashrate); headers = curl_slist_append(headers, ghashrate); - free(ghashrate); } headers = curl_slist_append(headers, len_hdr);