From 7635f07d49f33e390ebdac9876d0a8fbd1278110 Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Sun, 13 Jun 2021 21:58:25 +0200 Subject: [PATCH] Path out _difftime64() dependency. --- build.sh | 1 + patch/ssh2_session.diff | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 patch/ssh2_session.diff diff --git a/build.sh b/build.sh index e6a508a..f83edf4 100644 --- a/build.sh +++ b/build.sh @@ -123,6 +123,7 @@ pkg_ssh2="$(find "${LIBS_DIR}" -maxdepth 1 -name 'libssh2-*.tar.gz' | sort -rn | rm -rf "${SSH2_DIR}" && mkdir "${SSH2_DIR}" tar -xvf "${pkg_ssh2}" --strip-components=1 -C "${SSH2_DIR}" pushd "${SSH2_DIR}" +patch -p1 -b < "${BASE_DIR}/patch/ssh2_session.diff" CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -I${LIBS_DIR}/include" LDFLAGS="-L${LIBS_DIR}/lib" LIBS="-latomic" ./configure --disable-examples-build --disable-shared --with-libz make cp -v src/.libs/libssh2.a "${LIBS_DIR}/lib" diff --git a/patch/ssh2_session.diff b/patch/ssh2_session.diff new file mode 100644 index 0000000..a547f33 --- /dev/null +++ b/patch/ssh2_session.diff @@ -0,0 +1,22 @@ +diff --git "a/D:\\_Sandbox\\curl\\libssh2-x64\\src\\session.c.orig" "b/D:\\_Sandbox\\curl\\libssh2-x64\\src\\session.c" +index e439acd..476a497 100644 +--- "a/src/session.c" ++++ "b/src/session.c" +@@ -58,6 +58,8 @@ + #include "mac.h" + #include "misc.h" + ++#define DIFFTIME(X,Y) ((double)((Y) - (X))) ++ + /* libssh2_default_alloc + */ + static +@@ -610,7 +612,7 @@ int _libssh2_wait_socket(LIBSSH2_SESSION *session, time_t start_time) + (seconds_to_next == 0 || + ms_to_next > session->api_timeout)) { + time_t now = time(NULL); +- elapsed_ms = (long)(1000*difftime(now, start_time)); ++ elapsed_ms = (long)(1000*DIFFTIME(now, start_time)); + if(elapsed_ms > session->api_timeout) { + return _libssh2_error(session, LIBSSH2_ERROR_TIMEOUT, + "API timeout expired");