* fallback to fputime if fputimensat fails as not being available

git-svn-id: trunk@48474 -
(cherry picked from commit c3656c6b1c)
This commit is contained in:
florian 2021-01-31 18:09:57 +00:00 committed by marcoonthegit
parent 5ea32418d8
commit b2da1dbfba

View File

@ -1160,9 +1160,8 @@ var
SystemFileName: RawByteString;
{$ifdef USE_UTIMENSAT}
times : tkernel_timespecs;
{$else USE_UTIMENSAT}
t: TUTimBuf;
{$endif USE_UTIMENSAT}
t: TUTimBuf;
begin
SystemFileName:=ToSingleByteFileSystemEncodedFileName(FileName);
Result:=0;
@ -1173,12 +1172,15 @@ begin
times[1].tv_nsec:=0;
if fputimensat(AT_FDCWD,PChar(SystemFileName),times,0) = -1 then
Result:=fpgeterrno;
{$else USE_UTIMENSAT}
t.actime:= Age;
t.modtime:=Age;
if fputime(PChar(SystemFileName), @t) = -1 then
Result:=fpgeterrno;
if fpgeterrno=ESysENOSYS then
{$endif USE_UTIMENSAT}
begin
Result:=0;
t.actime:= Age;
t.modtime:=Age;
if fputime(PChar(SystemFileName), @t) = -1 then
Result:=fpgeterrno;
end
end;
{****************************************************************************