diff --git a/src/wolfscp.c b/src/wolfscp.c index 7a94939a9..90764c26a 100644 --- a/src/wolfscp.c +++ b/src/wolfscp.c @@ -2266,7 +2266,7 @@ static int SetTimestampInfo(WFILE* fp, const char* fileName, #ifdef USE_WINDOWS_API struct _utimbuf tmp; int fd; -#else +#elif !defined(WOLFSSH_NO_UTIMES) struct timeval tmp[2]; #endif @@ -2287,6 +2287,11 @@ static int SetTimestampInfo(WFILE* fp, const char* fileName, if (WFFLUSH(fp) != 0 || _commit(fd) != 0 || _futime(fd, &tmp) != 0) ret = WS_FATAL_ERROR; } +#elif defined(WOLFSSH_NO_UTIMES) + /* No utimes() on this port; the file keeps its creation timestamps. */ + (void)fp; + (void)mTime; + (void)aTime; #else tmp[0].tv_sec = (time_t)aTime; tmp[0].tv_usec = 0; diff --git a/wolfssh/port.h b/wolfssh/port.h index cb1c08b39..3be71494f 100644 --- a/wolfssh/port.h +++ b/wolfssh/port.h @@ -368,10 +368,10 @@ extern "C" { #include #include - #if ZEPHYR_VERSION_CODE >= ZEPHYR_VERSION(4, 1, 0) - /* struct timeval: pre-4.1 it arrived via the socket headers when - * NET_SOCKETS_POSIX_NAMES was set; 4.1+ needs the POSIX header - * (CONFIG_POSIX_API). */ + /* struct timeval. Include it directly rather than relying on it arriving + * transitively through wolfSSL's Zephyr POSIX includes. */ + #if defined(CONFIG_POSIX_API) || \ + ZEPHYR_VERSION_CODE >= ZEPHYR_VERSION(4, 1, 0) #include #endif #include @@ -400,7 +400,8 @@ extern "C" { #define WFGETS(b,s,f) NULL /* Not ported yet */ #undef WFPUTS #define WFPUTS(b,s) EOF /* Not ported yet */ - #define WUTIMES(a,b) ((void)(a),(void)(b),0) /* Not ported yet */ + #define WOLFSSH_NO_UTIMES + #define WUTIMES(a,b) (0) /* Not ported yet */ #define WCHDIR(fs,b) z_fs_chdir((b)) #elif defined(MICROCHIP_MPLAB_HARMONY) @@ -434,6 +435,7 @@ extern "C" { #define WFGETS(b,s,f) SYS_FS_FileStringGet((f), (b), (s)) #undef WFPUTS #define WFPUTS(b,f) SYS_FS_FileStringPut((f), (b)) + #define WOLFSSH_NO_UTIMES #define WUTIMES(a,b) (0) /* Not ported yet */ #define WSETTIME(fs,f,a,m) (0) #define WFSETTIME(fs,fd,a,m) (0) @@ -463,6 +465,7 @@ extern "C" { #define WSETTIME(fs,f,a,m) (0) #define WFSETTIME(fs,fd,a,m) (0) #ifdef WOLFSSL_VXWORKS + #define WOLFSSH_NO_UTIMES #define WUTIMES(f,t) (WS_SUCCESS) #elif defined(USE_WINDOWS_API) #include