Fix FreeBSD cycle starting for release compiler after FPSysCtl interface change

git-svn-id: trunk@35575 -
This commit is contained in:
pierre 2017-03-13 21:33:09 +00:00
parent 9fbb92a48d
commit 9fc17dc9e9

View File

@ -459,6 +459,21 @@ implementation
{$ifdef FreeBSD}
function GetOSRelDate:Longint;
{ FPSysCtl first argument was of type pchar
up to commit 35566 from 2017/03/11
and corrected to pcint in that commit.
But the following code needs to work with
both old 3.0.X definition and new definition using pcint type.
Problem solved using a special type called
FPSysCtlFirstArgType. }
{$ifdef VER3_0}
type
FPSysCtlFirstArgType = PChar;
{$else}
type
FPSysCtlFirstArgType = pcint;
{$endif}
var
mib : array[0..1] of cint;
rval : cint;
@ -475,7 +490,7 @@ Begin
mib[1] := KERN_OSRELDATE;
len := 4;
oerrno:= fpgeterrno;
if (FPsysctl(pChar(@mib), 2, pchar(@v), @len, NIL, 0) = -1) Then
if (FPsysctl(FPSysCtlFirstArgType(@mib), 2, pchar(@v), @len, NIL, 0) = -1) Then
Begin
if (fpgeterrno = ESysENOMEM) Then
fpseterrno(oerrno);