[syslog-ng] [PATCH] afinter: Make the parent class LogSrcDriver, instead of LogDriver.
Gergely Nagy
algernon at balabit.hu
Fri Apr 6 11:35:42 CEST 2012
The parent of AFInterSourceDriver should be LogSrcDriver, because
that's the struct we pass down to it anyway, and other parts of the
code will cast it back to LogSrcDriver, too.
But if its parent is LogDriver, as it was, we were corrupting the
later parts of the original LogSrcDriver, with values from
AFInterSourceDriver.
Many thanks to Peter Eisenlohr <peter.eisenlohr at inform-software.com>
for initial debugging, and for pinpointing mark messages as the
triggers.
Reported-by: Peter Czanik <czanik at balabit.hu>
Signed-off-by: Gergely Nagy <algernon at balabit.hu>
---
lib/afinter.c | 10 +++++-----
lib/afinter.h | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/afinter.c b/lib/afinter.c
index 23b1c82..b9d0ddf 100644
--- a/lib/afinter.c
+++ b/lib/afinter.c
@@ -304,7 +304,7 @@ afinter_source_new(AFInterSourceDriver *owner, LogSourceOptions *options)
AFInterSource *self = g_new0(AFInterSource, 1);
log_source_init_instance(&self->super);
- log_source_set_options(&self->super, options, 0, SCS_INTERNAL, owner->super.id, NULL, FALSE);
+ log_source_set_options(&self->super.super, options, 0, SCS_INTERNAL, owner->super.super.id, NULL, FALSE);
afinter_source_init_watches(self);
self->super.super.init = afinter_source_init;
self->super.super.deinit = afinter_source_deinit;
@@ -328,7 +328,7 @@ afinter_sd_init(LogPipe *s)
return FALSE;
}
- log_source_options_init(&self->source_options, cfg, self->super.group);
+ log_source_options_init(&self->source_options, cfg, self->super.super.group);
self->source = afinter_source_new(self, &self->source_options);
log_pipe_append(&self->source->super, s);
log_pipe_init(&self->source->super, cfg);
@@ -370,9 +370,9 @@ afinter_sd_new(void)
AFInterSourceDriver *self = g_new0(AFInterSourceDriver, 1);
log_src_driver_init_instance((LogSrcDriver *)&self->super);
- self->super.super.init = afinter_sd_init;
- self->super.super.deinit = afinter_sd_deinit;
- self->super.super.free_fn = afinter_sd_free;
+ self->super.super.super.init = afinter_sd_init;
+ self->super.super.super.deinit = afinter_sd_deinit;
+ self->super.super.super.free_fn = afinter_sd_free;
log_source_options_defaults(&self->source_options);
return (LogDriver *)&self->super.super;
}
diff --git a/lib/afinter.h b/lib/afinter.h
index 108475f..1cd9d78 100644
--- a/lib/afinter.h
+++ b/lib/afinter.h
@@ -33,7 +33,7 @@
*/
typedef struct _AFInterSourceDriver
{
- LogDriver super;
+ LogSrcDriver super;
LogSource *source;
LogSourceOptions source_options;
} AFInterSourceDriver;
--
1.7.9.1
More information about the syslog-ng
mailing list