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 |
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); |