Sfoglia il codice sorgente

* fallback to fputime if fputimensat fails as not being available

git-svn-id: trunk@48474 -
florian 4 anni fa
parent
commit
c3656c6b1c
1 ha cambiato i file con 9 aggiunte e 7 eliminazioni
  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;
 
 {****************************************************************************