fix for zephyr time include and UTIME guard

pull/1142/head
JacobBarthelmeh 2026-08-04 22:39:09 -06:00 committed by John Safranek
parent 719cc31b60
commit 2bc5629d44
2 changed files with 14 additions and 6 deletions

View File

@ -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;

View File

@ -368,10 +368,10 @@ extern "C" {
#include <zephyr/fs/fs.h>
#include <zephyr/version.h>
#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 <zephyr/posix/sys/time.h>
#endif
#include <stdlib.h>
@ -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 <sys/utime.h>