/[monit]/monit/spawn.c
ViewVC logotype

Diff of /monit/spawn.c

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

revision 1.27 by martinp, Tue Jul 22 19:51:19 2003 UTC revision 1.28 by martinp, Wed Jul 23 07:04:28 2003 UTC
# Line 118  void  spawn(Service_T S, Command_T C) { Line 118  void  spawn(Service_T S, Command_T C) {
118                
119      } else  {      } else  {
120    
       int i;  
       int max_descriptors = 1024;  
         
121        /*        /*
122         * Reset all signals, so the child process is         * Reset all signals, so the child process is
123         * *not* created with any inherited SIG_BLOCK         * *not* created with any inherited SIG_BLOCK
# Line 153  void  spawn(Service_T S, Command_T C) { Line 150  void  spawn(Service_T S, Command_T C) {
150    
151        set_monit_environment(S, C);        set_monit_environment(S, C);
152                
       log_close();  
   
       /*  
        * Require that the other file descriptios are closed. Everything  
        * seems to have getdtablesize, so we'll use it here, and back  
        * out to use 1024 if getdtablesize not available.  
        */  
 #ifdef HAVE_UNISTD_H  
       max_descriptors = getdtablesize();  
 #endif  
       for(i = 3; i < max_descriptors; i++)  
         (void) close(i);  
       errno= 0;  
   
153        if(! Run.isdaemon) {        if(! Run.isdaemon) {
154          redirect_stdfd();          redirect_stdfd();
155        }        }
156                
157          log_close();
158    
159          fd_close();
160    
161        (void) execv(C->arg[0], C->arg);        (void) execv(C->arg[0], C->arg);
162    
163        exec_alert_mail(S, C);        exec_alert_mail(S, C);

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26