mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-24 00:59:07 +02:00
Avoid SEGV in signal handler as second parameter is only a code, not a pointer
git-svn-id: trunk@20642 -
This commit is contained in:
parent
fdf0c4a644
commit
6edb8a286f
@ -38,6 +38,7 @@ const
|
||||
procedure SignalToRunerror(Sig: longint;info : PSigInfo;SigContext: PSigContextRec); public name '_FPC_DEFAULTSIGHANDLER'; cdecl;
|
||||
|
||||
var
|
||||
code : ptruint;
|
||||
res,fpustate : word;
|
||||
begin
|
||||
res:=0;
|
||||
@ -49,14 +50,20 @@ begin
|
||||
end;
|
||||
{$endif cpui386}
|
||||
{$endif BSD}
|
||||
{$ifdef DEBUG}
|
||||
Writeln(stderr,'Info is 0x',hexstr(ptruint(info),8));
|
||||
{$endif}
|
||||
case sig of
|
||||
SIGFPE :
|
||||
begin
|
||||
{ this is not allways necessary but I don't know yet
|
||||
how to tell if it is or not PM }
|
||||
res:=200;
|
||||
if assigned(info) then
|
||||
fpustate:=info^._info.si_code
|
||||
{ In netbsd, the second parameter is a code, not a pointer to a siginfo structure
|
||||
at least as long as we use sigaction14 }
|
||||
code:=ptruint(info);
|
||||
if code < high(fpustate) then
|
||||
fpustate:=code
|
||||
else
|
||||
fpustate:=FPE_IntDiv;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user