Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/wolfscp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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;
Expand Down
13 changes: 8 additions & 5 deletions wolfssh/port.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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>
Expand Down
Loading