Browse Source

* fallback to fputime if fputimensat fails as not being available

git-svn-id: trunk@48474 -
(cherry picked from commit c3656c6b1c220860458cda0c4f123055b609c738)
florian 4 years ago
parent
commit
b2da1dbfba
1 changed files with 9 additions and 7 deletions
  1. 9 7
      rtl/unix/sysutils.pp

+ 9 - 7
rtl/unix/sysutils.pp

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