projects
/
srvx.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
src/log.c: Avoid recursive logging.
[srvx.git]
/
src
/
log.c
diff --git
a/src/log.c
b/src/log.c
index fe9f74a35848f7ee271ecc8f0be2d55b5b9ee8e8..736360d91582709ddab4422dbdf9142d5b7b45f1 100644
(file)
--- a/
src/log.c
+++ b/
src/log.c
@@
-51,6
+51,7
@@
struct log_type {
unsigned int log_count;
unsigned int max_age;
unsigned int max_count;
unsigned int log_count;
unsigned int max_age;
unsigned int max_count;
+ unsigned int depth;
unsigned int default_set : 1;
};
unsigned int default_set : 1;
};
@@
-569,6
+570,9
@@
log_module(struct log_type *type, enum log_severity sev, const char *format, ...
if (!type)
return;
if (!type)
return;
+ if (type->depth)
+ return;
+ ++type->depth;
if (sev > LOG_FATAL) {
log_module(MAIN_LOG, LOG_ERROR, "Illegal log_module severity %d", sev);
return;
if (sev > LOG_FATAL) {
log_module(MAIN_LOG, LOG_ERROR, "Illegal log_module severity %d", sev);
return;
@@
-589,6
+593,7
@@
log_module(struct log_type *type, enum log_severity sev, const char *format, ...
/* Special behavior before we start full operation */
fprintf(stderr, "%s: %s\n", log_severity_names[sev], msgbuf);
}
/* Special behavior before we start full operation */
fprintf(stderr, "%s: %s\n", log_severity_names[sev], msgbuf);
}
+ --type->depth;
if (sev == LOG_FATAL) {
assert(0 && "fatal message logged");
_exit(1);
if (sev == LOG_FATAL) {
assert(0 && "fatal message logged");
_exit(1);