Permalink
Browse files

halfway revert hack/configure changes - switch order of daemon_init/d…

…rop_privileges
  • Loading branch information...
hedenface committed Jul 30, 2017
1 parent 60638cf commit 1b197346d490df2e2d3b1dcce5ac6134ad0c8752
Showing with 21 additions and 23 deletions.
  1. +2 −0 Changelog
  2. +1 −0 THANKS
  3. +16 −15 base/nagios.c
  4. +2 −8 configure.ac
View
@@ -8,6 +8,8 @@ Nagios Core 4 Change Log
* On-demand host check always use cached host state (John Frickson)
* 'á' causes Serivce Status Information to not be displayed (John Frickson)
* New Macro(s) to generate URL for host / service object (John Frickson)
* Fix minor map issues (Troy Lea)
* Fix lockfile issues (Bryan Heden)
4.3.2 - 2017-05-09
View
1 THANKS
@@ -320,6 +320,7 @@ wrong, please let me know.
* Tomer Okavi
* Ton Voon
* Torsten Huebler
* Troy Lea
* Tyler Lund
* Uwe Knop
* Uwe Knop
View
@@ -592,6 +592,22 @@ int main(int argc, char **argv) {
program_start = time(NULL);
my_free(mac->x[MACRO_PROCESSSTARTTIME]);
asprintf(&mac->x[MACRO_PROCESSSTARTTIME], "%llu", (unsigned long long)program_start);
/* enter daemon mode (unless we're restarting...) */
if(daemon_mode == TRUE && sigrestart == FALSE) {
result = daemon_init();
/* we had an error daemonizing, so bail... */
if(result == ERROR) {
logit(NSLOG_PROCESS_INFO | NSLOG_RUNTIME_ERROR, TRUE, "Bailing out due to failure to daemonize. (PID=%d)", (int)getpid());
cleanup();
exit(EXIT_FAILURE);
}
/* get new PID */
nagios_pid = (int)getpid();
}
/* drop privileges */
if(drop_privileges(nagios_user, nagios_group) == ERROR) {
@@ -612,21 +628,6 @@ int main(int argc, char **argv) {
/* error has already been logged */
exit(EXIT_FAILURE);
}
/* enter daemon mode (unless we're restarting...) */
if(daemon_mode == TRUE && sigrestart == FALSE) {
result = daemon_init();
/* we had an error daemonizing, so bail... */
if(result == ERROR) {
logit(NSLOG_PROCESS_INFO | NSLOG_RUNTIME_ERROR, TRUE, "Bailing out due to failure to daemonize. (PID=%d)", (int)getpid());
cleanup();
exit(EXIT_FAILURE);
}
/* get new PID */
nagios_pid = (int)getpid();
}
/* this must be logged after we read config data, as user may have changed location of main log file */
logit(NSLOG_PROCESS_INFO, TRUE, "Nagios %s starting... (PID=%d)\n", PROGRAM_VERSION, (int)getpid());
View
@@ -227,6 +227,7 @@ AC_ARG_WITH(checkresult-dir,
if test x$CHECKRESULTDIR = xno; then
CHECKRESULTDIR="$localstatedir/spool/checkresults"
fi
AC_SUBST(CHECKRESULTDIR)
dnl Location of check result path
TMPDIR=no
@@ -270,7 +271,7 @@ AC_ARG_WITH(lockfile,
lockfile=$withval,
lockfile=$localstatedir/nagios.lock
)
AC_SUBST(lockfile)
dnl Determine the library to be used by the iobroker
@@ -819,13 +820,6 @@ perl subst sample-config/template-object/printer.cfg
perl subst sample-config/template-object/switch.cfg
eval localstatedir=$localstatedir
eval lockfile=$lockfile
eval CHECKRESULTDIR=$CHECKRESULTDIR
AC_SUBST(CHECKRESULTDIR)
AC_SUBST(lockfile)
dnl Review options
echo ""
echo ""

0 comments on commit 1b19734

Please sign in to comment.