summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-11-20 18:41:04 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2009-11-20 18:41:04 +0100
commit5b55ab75e27861241981ae447ed3d1b8ad968deb (patch)
tree61e68ee2da0ea1bb728c3532a119a7f010af2a84
parentdffcfa8699c41d9f64b7aee131a32661587ce441 (diff)
downloadrsyslog-5b55ab75e27861241981ae447ed3d1b8ad968deb.tar.gz
rsyslog-5b55ab75e27861241981ae447ed3d1b8ad968deb.tar.xz
rsyslog-5b55ab75e27861241981ae447ed3d1b8ad968deb.zip
debugondemand mode caused backgrounding to fail
This is close to a bug, but I'd consider the ability to background in this mode a new feature...
-rw-r--r--ChangeLog8
-rw-r--r--runtime/debug.c4
-rw-r--r--runtime/debug.h5
-rw-r--r--tools/syslogd.c10
4 files changed, 17 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 9e54bd1b..e3194389 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,3 @@
-- added option to use unlimited-size select() calls
- Thanks to varmjofekoj for the patch
---------------------------------------------------------------------------
Version 4.7.0 [v4-devel] (rgerhards), 2009-09-??
- added function getenv() to RainerScript
@@ -14,7 +12,11 @@ Version 4.7.0 [v4-devel] (rgerhards), 2009-09-??
- added new config directive $omfileForceChown to (try to) fix some broken
system configs.
See ticket for details: http://bugzilla.adiscon.com/show_bug.cgi?id=150
-- imported changes from 4.5.6 and below
+- added option to use unlimited-size select() calls
+ Thanks to varmjofekoj for the patch
+- debugondemand mode caused backgrounding to fail - close to a bug, but I'd
+ consider the ability to background in this mode a new feature...
+- imported changes from 4.5.7 and below
---------------------------------------------------------------------------
Version 4.5.7 [v4-beta] (rgerhards), 2009-11-18
- added a so-called "On Demand Debug" mode, in which debug output can
diff --git a/runtime/debug.c b/runtime/debug.c
index 9547eee6..c23dec3b 100644
--- a/runtime/debug.c
+++ b/runtime/debug.c
@@ -1271,11 +1271,11 @@ dbgGetRuntimeOptions(void)
/* this is earlier in the process than the -d option, as such it
* allows us to spit out debug messages from the very beginning.
*/
- Debug = 1;
+ Debug = DEBUG_FULL;
debugging_on = 1;
} else if(!strcasecmp((char*)optname, "debugondemand")) {
/* Enables debugging, but turns off debug output */
- Debug = 1;
+ Debug = DEBUG_ONDEMAND;
debugging_on = 1;
dbgprintf("Note: debug on demand turned on via configuraton file, "
"use USR1 signal to activate.\n");
diff --git a/runtime/debug.h b/runtime/debug.h
index dcbfb930..cfdf819c 100644
--- a/runtime/debug.h
+++ b/runtime/debug.h
@@ -29,6 +29,11 @@
#include <pthread.h>
#include "obj-types.h"
+/* some settings for various debug modes */
+#define DEBUG_OFF 0
+#define DEBUG_ONDEMAND 1
+#define DEBUG_FULL 2
+
/* external static data elements (some time to be replaced) */
extern int Debug; /* debug flag - read-only after startup */
extern int debugging_on; /* read-only, except on sig USR1 */
diff --git a/tools/syslogd.c b/tools/syslogd.c
index e03bf4d8..f11808f3 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -904,7 +904,7 @@ logmsgInternal(int iErr, int pri, uchar *msg, int flags)
* permits us to process unmodified config files which otherwise contain a
* supressor statement.
*/
- if(((Debug || NoFork) && bErrMsgToStderr) || iConfigVerify) {
+ if(((Debug == DEBUG_FULL || NoFork) && bErrMsgToStderr) || iConfigVerify) {
if(LOG_PRI(pri) == LOG_ERR)
fprintf(stderr, "rsyslogd: %s\n", msg);
}
@@ -1644,10 +1644,10 @@ static void doDie(int sig)
# define MSG1 "DoDie called.\n"
# define MSG2 "DoDie called 5 times - unconditional exit\n"
static int iRetries = 0; /* debug aid */
- if(Debug)
+ if(Debug == DEBUG_FULL)
write(1, MSG1, sizeof(MSG1) - 1);
if(iRetries++ == 4) {
- if(Debug)
+ if(Debug == DEBUG_FULL)
write(1, MSG2, sizeof(MSG2) - 1);
abort();
}
@@ -2881,7 +2881,7 @@ static rsRetVal mainThread()
* is still in its infancy (and not really done), we currently accept this issue.
* rgerhards, 2009-06-29
*/
- if(!(Debug || NoFork)) {
+ if(!(Debug == DEBUG_FULL || NoFork)) {
close(1);
close(2);
bErrMsgToStderr = 0;
@@ -3072,7 +3072,7 @@ doGlblProcessInit(void)
thrdInit();
- if( !(Debug || NoFork) )
+ if( !(Debug == DEBUG_FULL || NoFork) )
{
DBGPRINTF("Checking pidfile.\n");
if (!check_pid(PidFile))