/[projects]/smsdaemon/daemon.cpp
ViewVC logotype

Diff of /smsdaemon/daemon.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 190 by torben, Wed Dec 17 13:51:57 2008 UTC revision 325 by torben, Wed Sep 16 16:37:34 2009 UTC
# Line 4  Line 4 
4  #include <fcntl.h>  #include <fcntl.h>
5  #include <stdlib.h>  #include <stdlib.h>
6  #include <cstring>  #include <cstring>
7    #include <cstdio>
8    
9  #include <sys/types.h>  #include <sys/types.h>
10  #include <pwd.h>  #include <pwd.h>
# Line 25  void signal_handler(int sig) Line 26  void signal_handler(int sig)
26          switch (sig)          switch (sig)
27          {          {
28          case SIGHUP:          case SIGHUP:
29                  Logger::logMessage("hangup signal catched");                  Logger::logMessage("Reload config");
30                    Common::instance()->reloadConfig = true;
31    
32                  break;                  break;
33    
34          case SIGTERM:          case SIGTERM:
# Line 44  void lookup_uid_values() Line 47  void lookup_uid_values()
47  {  {
48          Common* cmn = Common::instance();          Common* cmn = Common::instance();
49    
50          std::string userstr = cmn->GetConfigfile()->GetValue("smsdaemon","user");          std::string userstr = cmn->GetConfigfile()->GetValue("smsdaemon","user","");
51          std::string groupstr = cmn->GetConfigfile()->GetValue("smsdaemon","group");          std::string groupstr = cmn->GetConfigfile()->GetValue("smsdaemon","group","");
52    
53          passwd* pass = getpwnam(userstr.c_str());          passwd* pass = getpwnam(userstr.c_str());
54          if (pass != 0)          if (pass != 0)
# Line 76  void daemonCleanup() Line 79  void daemonCleanup()
79  {  {
80          Common* cmn = Common::instance();          Common* cmn = Common::instance();
81          Logger::logMessage("Cleaning up daemon");          Logger::logMessage("Cleaning up daemon");
82            
83          seteuid(0);          seteuid(0);
84          setegid(0);          setegid(0);
85          unlink( cmn->pidfile.c_str() );          unlink( cmn->pidfile.c_str() );

Legend:
Removed from v.190  
changed lines
  Added in v.325

  ViewVC Help
Powered by ViewVC 1.1.20