1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 19:12:48 -05:00

Add an autoconf test and workaround for futimes(3).

Not every system provides it (e.g. uClibc-ng); if one does not, the
Uppity SFTP server should now degrade sensibly to refusing attempts to
set the utimes on an already-open file.
This commit is contained in:
Simon Tatham
2019-03-26 18:39:40 +00:00
parent e9f0abad2e
commit 94f955fa90
2 changed files with 11 additions and 1 deletions

View File

@ -412,6 +412,16 @@ static void uss_fstat(SftpServer *srv, SftpReplyBuilder *reply,
}
}
#if !HAVE_FUTIMES
static inline int futimes(int fd, const struct timeval tv[2])
{
/* If the OS doesn't support futimes(3) then we have to pretend it
* always returns failure */
errno = EINVAL;
return -1;
}
#endif
/*
* The guts of setstat and fsetstat, macroised so that they can call
* fchown(fd,...) or chown(path,...) depending on parameters.