X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;ds=sidebyside;f=src%2Fshared%2Fsig_op.c;h=4ab56418fe27e588fa205f090b74035a419bea35;hb=HEAD;hp=7820f21f4a2e9a5385dbeb8934ed20383ebb4d5d;hpb=914feba5d54f979cd5d7e69c349c3d01f630042a;p=ossec-hids.git diff --git a/src/shared/sig_op.c b/src/shared/sig_op.c old mode 100755 new mode 100644 index 7820f21..4ab5641 --- a/src/shared/sig_op.c +++ b/src/shared/sig_op.c @@ -1,55 +1,50 @@ -/* @(#) $Id: sig_op.c,v 1.8 2009/06/24 18:53:09 dcid Exp $ */ - /* Copyright (C) 2009 Trend Micro Inc. * All right reserved. * * This program is a free software; you can redistribute it * and/or modify it under the terms of the GNU General Public - * License (version 3) as published by the FSF - Free Software + * License (version 2) as published by the FSF - Free Software * Foundation */ - -/* Functions to handle signal manipulation - */ +/* Functions to handle signal manipulation */ #ifndef WIN32 #include #include #include +#include #include "sig_op.h" #include "file_op.h" #include "debug_op.h" - #include "error_messages/error_messages.h" -char *pidfile = NULL; +static const char *pidfile = NULL; + -void HandleSIG() +void HandleSIG(int sig) { - merror(SIGNAL_RECV, pidfile); - + merror(SIGNAL_RECV, pidfile, sig, strsignal(sig)); + DeletePID(pidfile); - + exit(1); } /* To avoid client-server communication problems */ -void HandleSIGPIPE() +void HandleSIGPIPE(__attribute__((unused)) int sig) { return; } -void StartSIG(char *process_name) +void StartSIG(const char *process_name) { - /* Signal Manipulation - go to HandleSIG() */ pidfile = process_name; - signal(SIGHUP, SIG_IGN); + signal(SIGHUP, SIG_IGN); signal(SIGINT, HandleSIG); signal(SIGQUIT, HandleSIG); signal(SIGTERM, HandleSIG); @@ -57,7 +52,7 @@ void StartSIG(char *process_name) signal(SIGPIPE, HandleSIGPIPE); } -void StartSIG2(char *process_name, void (*func)(int)) +void StartSIG2(const char *process_name, void (*func)(int)) { pidfile = process_name; @@ -69,5 +64,5 @@ void StartSIG2(char *process_name, void (*func)(int)) signal(SIGPIPE, HandleSIGPIPE); } -#endif -/* EOF */ +#endif /* !WIN32 */ +