[syslog-ng] syslog-ng 1.9.5 segfaults on many platforms
Balazs Scheidler
bazsi at balabit.hu
Tue Aug 30 09:32:11 CEST 2005
Thanks for tracking this down. Here's the patch, it should be added in
tomorrow's snapshot:
--- orig/src/affile.c
+++ mod/src/affile.c
@@ -367,35 +367,6 @@ affile_dd_set_create_dirs(LogDriver *s,
self->flags &= ~AFFILE_CREATE_DIRS;
}
-void
-affile_dd_set_file_template(LogDriver *s, gchar *template)
-{
- AFFileDestDriver *self = (AFFileDestDriver *) s;
-
- g_string_assign(self->template, template);
-}
-
-void
-affile_dd_set_template_escape(LogDriver *s, gboolean enable)
-{
- AFFileDestDriver *self = (AFFileDestDriver *) s;
-
- if (self->writer_options.template && self->writer_options.template->def_inline)
- {
- log_template_set_escape(self->writer_options.template, enable);
- }
- else
- {
- msg_notice("Macro escaping can only be specified for inline templates", NULL);
- }
-}
-
-void
-affile_dd_set_fsync(LogDriver *s G_GNUC_UNUSED, gboolean enable G_GNUC_UNUSED)
-{
- msg_error("fsync() does not work yet", NULL);
-}
-
static time_t reap_now = 0;
static gboolean
@@ -559,7 +530,6 @@ affile_dd_free(LogPipe *s)
AFFileDestDriver *self = (AFFileDestDriver *) s;
log_template_unref(self->filename_template);
- g_string_free(self->template, TRUE);
log_pipe_unref(self->writer);
if (self->writer_hash)
g_hash_table_destroy(self->writer_hash);
@@ -579,7 +549,6 @@ affile_dd_new(gchar *filename, guint32 f
self->super.super.queue = affile_dd_queue;
self->super.super.free_fn = affile_dd_free;
self->filename_template = log_template_new(NULL, filename);
- self->template = g_string_sized_new(0);
self->flags = flags;
self->file_uid = self->file_gid = -1;
self->file_perm = -1;
--- orig/src/affile.h
+++ mod/src/affile.h
@@ -50,7 +50,6 @@ typedef struct _AFFileDestDriver
LogTemplate *filename_template;
LogPipe *writer;
guint32 flags;
- GString *template;
uid_t file_uid;
gid_t file_gid;
mode_t file_perm;
@@ -77,8 +76,6 @@ void affile_dd_set_dir_uid(LogDriver *s,
void affile_dd_set_dir_gid(LogDriver *s, const gchar *dir_gid);
void affile_dd_set_dir_perm(LogDriver *s, mode_t dir_perm);
void affile_dd_set_create_dirs(LogDriver *s, gboolean create_dirs);
-void affile_dd_set_file_template(LogDriver *s, gchar *template);
-void affile_dd_set_template_escape(LogDriver *s, gboolean enable);
void affile_dd_set_fsync(LogDriver *s, gboolean enable);
#endif
--- orig/src/cfg-grammar.y
+++ mod/src/cfg-grammar.y
@@ -624,8 +624,8 @@ dest_writer_option
log_template_ref(last_writer_options->template);
free($3);
}
- | KW_TEMPLATE_ESCAPE '(' yesno ')' { affile_dd_set_template_escape(last_driver, $3); }
- | KW_FSYNC '(' yesno ')' { affile_dd_set_fsync(last_driver, $3); }
+ | KW_TEMPLATE_ESCAPE '(' yesno ')' { log_writer_options_set_template_escape(last_writer_options, $3); }
+ | KW_FSYNC '(' yesno ')' { msg_error("fsync() does not work yet", NULL); }
| KW_KEEP_TIMESTAMP '(' yesno ')' { last_writer_options->keep_timestamp = $3; }
| KW_TIME_ZONE '(' string ')' { cfg_timezone_value($3, &last_writer_options->zone_offset); free($3); }
| KW_TS_FORMAT '(' string ')' { last_writer_options->ts_format = cfg_ts_format_value($3); free($3); }
--- orig/src/logwriter.c
+++ mod/src/logwriter.c
@@ -412,6 +412,19 @@ log_writer_options_defaults(LogWriterOpt
options->zone_offset = -1;
}
+void
+log_writer_options_set_template_escape(LogWriterOptions *options, gboolean enable)
+{
+ if (options->template && options->template->def_inline)
+ {
+ log_template_set_escape(options->template, enable);
+ }
+ else
+ {
+ msg_notice("Macro escaping can only be specified for inline templates", NULL);
+ }
+}
+
void
log_writer_options_init(LogWriterOptions *options, GlobalConfig *cfg, gboolean fixed_stamp)
{
--
Bazsi
More information about the syslog-ng
mailing list