From 633446fccee9c2f2273b4a5e2022abf0f5ccb540 Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Fri, 7 Feb 2020 15:58:52 -0700 Subject: [PATCH 1/2] move guess of SIZEOF_OFF_T in non-autoconf builds to port.h --- src/port.c | 10 ---------- src/wolfsftp.c | 11 +++++++++++ wolfssh/port.h | 11 +++++++++++ 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/port.c b/src/port.c index c1effe5..0909b36 100644 --- a/src/port.c +++ b/src/port.c @@ -85,16 +85,6 @@ int wfopen(WFILE** f, const char* filename, const char* mode) #if (defined(WOLFSSH_SFTP) || defined(WOLFSSH_SCP)) && \ !defined(NO_WOLFSSH_SERVER) - #ifndef SIZEOF_OFF_T - /* if not using autoconf then make a guess on off_t size based on sizeof - * long long */ - #if defined(SIZEOF_LONG) && SIZEOF_LONG == 8 - #define SIZEOF_OFF_T 8 - #else - #define SIZEOF_OFF_T 4 - #endif - #endif - #if defined(USE_WINDOWS_API) || defined(WOLFSSL_NUCLEUS) || \ defined(FREESCALE_MQX) diff --git a/src/wolfsftp.c b/src/wolfsftp.c index 3555342..658846d 100644 --- a/src/wolfsftp.c +++ b/src/wolfsftp.c @@ -38,6 +38,17 @@ #endif +#ifndef SIZEOF_OFF_T + /* if not using autoconf then make a guess on off_t size based on sizeof + * long long */ + #if defined(SIZEOF_LONG) && SIZEOF_LONG == 8 + #define SIZEOF_OFF_T 8 + #else + #define SIZEOF_OFF_T 4 + #endif +#endif + + /* enum for bit field with an ID of each of the state structures */ enum WS_SFTP_STATE_ID { STATE_ID_ALL = 0, /* default to select all */ diff --git a/wolfssh/port.h b/wolfssh/port.h index e3ded84..1cfbd28 100644 --- a/wolfssh/port.h +++ b/wolfssh/port.h @@ -349,6 +349,17 @@ extern "C" { #if (defined(WOLFSSH_SFTP) || defined(WOLFSSH_SCP)) && \ !defined(NO_WOLFSSH_SERVER) + + #ifndef SIZEOF_OFF_T + /* if not using autoconf then make a guess on off_t size based on sizeof + * long long */ + #if defined(SIZEOF_LONG) && SIZEOF_LONG == 8 + #define SIZEOF_OFF_T 8 + #else + #define SIZEOF_OFF_T 4 + #endif + #endif + #ifdef WOLFSSL_NUCLEUS #define WSTAT_T struct stat #define WRMDIR(fs,d) (NU_Remove_Dir((d)) == NU_SUCCESS)?0:1 From a5c630f3aa617ddb37ca0d3dfca136895d1301a1 Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Mon, 10 Feb 2020 14:02:17 -0700 Subject: [PATCH 2/2] revert setting SIZEOF_OFF_T in wolfsftp.c --- src/wolfsftp.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/wolfsftp.c b/src/wolfsftp.c index 658846d..9849a17 100644 --- a/src/wolfsftp.c +++ b/src/wolfsftp.c @@ -37,18 +37,6 @@ #include "src/misc.c" #endif - -#ifndef SIZEOF_OFF_T - /* if not using autoconf then make a guess on off_t size based on sizeof - * long long */ - #if defined(SIZEOF_LONG) && SIZEOF_LONG == 8 - #define SIZEOF_OFF_T 8 - #else - #define SIZEOF_OFF_T 4 - #endif -#endif - - /* enum for bit field with an ID of each of the state structures */ enum WS_SFTP_STATE_ID { STATE_ID_ALL = 0, /* default to select all */