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

Diff of /smsdaemon/daemon.cpp

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

revision 157 by torben, Mon Dec 8 21:28:40 2008 UTC revision 214 by torben, Mon Dec 22 22:22:42 2008 UTC
# Line 12  Line 12 
12    
13  #include "ConfigFile.h"  #include "ConfigFile.h"
14  #include "daemon.h"  #include "daemon.h"
15  #include "common.h"  #include "Common.h"
16  #include "Logger.h"  #include "Logger.h"
17    
18    
# Line 25  void signal_handler(int sig) Line 25  void signal_handler(int sig)
25          switch (sig)          switch (sig)
26          {          {
27          case SIGHUP:          case SIGHUP:
28                  Logger::logMessage("hangup signal catched");                  Logger::logMessage("Reload config");
29                    Common::instance()->reloadConfig = true;
30    
31                  break;                  break;
32    
33          case SIGTERM:          case SIGTERM:
# Line 44  void lookup_uid_values() Line 46  void lookup_uid_values()
46  {  {
47          Common* cmn = Common::instance();          Common* cmn = Common::instance();
48    
49          std::string userstr = cmn->GetConfigfile()->GetValue("smsdaemon","user");          std::string userstr = cmn->GetConfigfile()->GetValue("smsdaemon","user","");
50          std::string groupstr = cmn->GetConfigfile()->GetValue("smsdaemon","group");          std::string groupstr = cmn->GetConfigfile()->GetValue("smsdaemon","group","");
51    
52          passwd* pass = getpwnam(userstr.c_str());          passwd* pass = getpwnam(userstr.c_str());
53          if (pass != 0)          if (pass != 0)
# Line 74  void lookup_uid_values() Line 76  void lookup_uid_values()
76    
77  void daemonCleanup()  void daemonCleanup()
78  {  {
79          unlink( Common::instance()->pidfile.c_str() );          Common* cmn = Common::instance();
80            Logger::logMessage("Cleaning up daemon");
81    
82            seteuid(0);
83            setegid(0);
84            unlink( cmn->pidfile.c_str() );
85    
86  }  }
87    
88  void daemonize()  void daemonize()

Legend:
Removed from v.157  
changed lines
  Added in v.214

  ViewVC Help
Powered by ViewVC 1.1.20