mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-12 12:10:42 +01:00
Avoid range check error in FindGetFileInfo function on AIX OS and change type of local variable LinAttr to match argument type of fpS_ISDIR function
This commit is contained in:
parent
b40e89d4c8
commit
ad03158349
@ -533,7 +533,10 @@ begin
|
|||||||
f.Name:=Copy(s,f.NamePos+1,255);
|
f.Name:=Copy(s,f.NamePos+1,255);
|
||||||
f.Attr:=Info.FMode;
|
f.Attr:=Info.FMode;
|
||||||
f.Size:=Info.FSize;
|
f.Size:=Info.FSize;
|
||||||
f.mode:=st.st_mode;
|
{ At least on AIX OS, st_mode has high bits (outside 16-bit word range)
|
||||||
|
which are used for specific extensions.
|
||||||
|
Add explicit typecast to avoid Range check error. }
|
||||||
|
f.mode:=Word(st.st_mode);
|
||||||
UnixDateToDT(Info.FMTime, DT);
|
UnixDateToDT(Info.FMTime, DT);
|
||||||
PackTime(DT,f.Time);
|
PackTime(DT,f.Time);
|
||||||
FindGetFileInfo:=true;
|
FindGetFileInfo:=true;
|
||||||
@ -724,7 +727,7 @@ End;
|
|||||||
Procedure GetFAttr(var f; var attr : word);
|
Procedure GetFAttr(var f; var attr : word);
|
||||||
Var
|
Var
|
||||||
info : BU.stat;
|
info : BU.stat;
|
||||||
LinAttr : longint;
|
LinAttr : TMode;
|
||||||
p : PAnsiChar;
|
p : PAnsiChar;
|
||||||
{$ifndef FPC_ANSI_TEXTFILEREC}
|
{$ifndef FPC_ANSI_TEXTFILEREC}
|
||||||
r : RawByteString;
|
r : RawByteString;
|
||||||
@ -749,7 +752,7 @@ Begin
|
|||||||
exit;
|
exit;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
LinAttr:=Info.st_Mode;
|
LinAttr:=TMode(Info.st_Mode);
|
||||||
if fpS_ISDIR(LinAttr) then
|
if fpS_ISDIR(LinAttr) then
|
||||||
Attr:=$10
|
Attr:=$10
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user