Browse Source

* Fix bug ID #32172, correct installation of sighandlers

git-svn-id: trunk@36752 -
michael 8 years ago
parent
commit
b34ff11803
1 changed files with 14 additions and 6 deletions
  1. 14 6
      packages/fcl-extra/src/unix/daemonapp.inc

+ 14 - 6
packages/fcl-extra/src/unix/daemonapp.inc

@@ -218,14 +218,22 @@ end;
 
 
 Procedure SysInitDaemonApp;
 Procedure SysInitDaemonApp;
 
 
-Var
-  old,new : SigactionRec;
+  Procedure installhandler(aSig : Longint);
+
+  Var
+    old,new : SigactionRec;
+
+  begin
+    FillChar(New,SizeOf(Sigactionrec),#0);
+    FillChar(Old,SizeOf(Sigactionrec),#0);
+    New.sa_handler:=@DoShutDown;
+    fpSigaction(aSig,@New,@Old);
+  end;
 
 
 begin
 begin
-  New.sa_handler:=@DoShutDown;
-  fpSigaction(SIGQUIT,@New,@Old);
-  fpSigaction(SIGTERM,@New,@Old);
-  fpSigaction(SIGINT,@New,@Old);
+  InstallHandler(SIGQUIT);
+  InstallHandler(SIGTERM);
+  InstallHandler(SIGINT);
 end;
 end;