mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-09 14:28:12 +00:00
Link with pthreads lib, if present. Remove GNU-specific asprintf usage.
This commit is contained in:
parent
5d1a45294b
commit
59f1fb2ec8
@ -7,5 +7,5 @@ EXTRA_DIST = sha256_generic.c
|
|||||||
|
|
||||||
minerd_SOURCES = util.c cpu-miner.c miner.h
|
minerd_SOURCES = util.c cpu-miner.c miner.h
|
||||||
minerd_LDFLAGS = -pthread
|
minerd_LDFLAGS = -pthread
|
||||||
minerd_LDADD = @LIBCURL@ @JANSSON_LIBS@
|
minerd_LDADD = @LIBCURL@ @JANSSON_LIBS@ @PTHREAD_LIBS@
|
||||||
|
|
||||||
|
@ -12,11 +12,13 @@ dnl Checks for programs
|
|||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_PROG_GCC_TRADITIONAL
|
AC_PROG_GCC_TRADITIONAL
|
||||||
AM_PROG_CC_C_O
|
AM_PROG_CC_C_O
|
||||||
|
AC_PROG_RANLIB
|
||||||
|
|
||||||
dnl Checks for header files.
|
dnl Checks for header files.
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
|
|
||||||
AC_CHECK_LIB(jansson, json_loads, JANSSON_LIBS=-ljansson)
|
AC_CHECK_LIB(jansson, json_loads, JANSSON_LIBS=-ljansson)
|
||||||
|
AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIBS=-lpthread)
|
||||||
|
|
||||||
PKG_PROG_PKG_CONFIG()
|
PKG_PROG_PKG_CONFIG()
|
||||||
|
|
||||||
@ -24,6 +26,7 @@ LIBCURL_CHECK_CONFIG(, 7.10.1, ,
|
|||||||
[AC_MSG_ERROR([Missing required libcurl >= 7.10.1])])
|
[AC_MSG_ERROR([Missing required libcurl >= 7.10.1])])
|
||||||
|
|
||||||
AC_SUBST(JANSSON_LIBS)
|
AC_SUBST(JANSSON_LIBS)
|
||||||
|
AC_SUBST(PTHREAD_LIBS)
|
||||||
|
|
||||||
AC_CONFIG_FILES([
|
AC_CONFIG_FILES([
|
||||||
Makefile
|
Makefile
|
||||||
|
14
cpu-miner.c
14
cpu-miner.c
@ -8,7 +8,6 @@
|
|||||||
* any later version. See COPYING for more details.
|
* any later version. See COPYING for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _GNU_SOURCE
|
|
||||||
#include "cpuminer-config.h"
|
#include "cpuminer-config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -136,8 +135,9 @@ err_out:
|
|||||||
|
|
||||||
static void submit_work(struct work *work)
|
static void submit_work(struct work *work)
|
||||||
{
|
{
|
||||||
char *hexstr = NULL, *s = NULL;
|
char *hexstr = NULL;
|
||||||
json_t *val, *res;
|
json_t *val, *res;
|
||||||
|
char s[256];
|
||||||
|
|
||||||
printf("PROOF OF WORK FOUND? submitting...\n");
|
printf("PROOF OF WORK FOUND? submitting...\n");
|
||||||
|
|
||||||
@ -147,12 +147,9 @@ static void submit_work(struct work *work)
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
/* build JSON-RPC request */
|
/* build JSON-RPC request */
|
||||||
if (asprintf(&s,
|
sprintf(s,
|
||||||
"{\"method\": \"getwork\", \"params\": [ \"%s\" ], \"id\":1}\r\n",
|
"{\"method\": \"getwork\", \"params\": [ \"%s\" ], \"id\":1}\r\n",
|
||||||
hexstr) < 0) {
|
hexstr);
|
||||||
fprintf(stderr, "asprintf failed\n");
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (opt_debug)
|
if (opt_debug)
|
||||||
fprintf(stderr, "DBG: sending RPC call:\n%s", s);
|
fprintf(stderr, "DBG: sending RPC call:\n%s", s);
|
||||||
@ -172,7 +169,6 @@ static void submit_work(struct work *work)
|
|||||||
json_decref(val);
|
json_decref(val);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
free(s);
|
|
||||||
free(hexstr);
|
free(hexstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user