]> git.pld-linux.org Git - packages/syslog-ng.git/blob - bug-15.patch
- vim syntax available separately: vim-syntax-syslog-ng
[packages/syslog-ng.git] / bug-15.patch
1 diff --git a/src/afinter.c b/src/afinter.c
2 index 0085d85..a67a9a7 100644
3 --- a/src/afinter.c
4 +++ b/src/afinter.c
5 @@ -34,6 +34,7 @@ typedef struct _AFInterSourceDriver
6  } AFInterSourceDriver;
7  
8  static gint next_mark_target = -1;
9 +static GSource *global_internal_source;
10  
11  void 
12  afinter_postpone_mark(gint mark_freq)
13 @@ -121,6 +122,7 @@ afinter_source_dispatch(GSource *source,
14  static void
15  afinter_source_finalize(GSource *source)
16  {
17 +  global_internal_source = NULL;
18  }
19  
20  GSourceFuncs afinter_source_watch_funcs =
21 @@ -161,11 +163,26 @@ afinter_source_init(LogPipe *s)
22    
23    if (!log_source_init(s))
24      return FALSE;
25 +
26 +  if (cfg->internal_source_present)
27 +    {
28 +      msg_error("You have two internal() sources in your configuration, this is not supported and would cause hangs", NULL);
29 +      return FALSE;
30 +    }
31    
32 +  if (global_internal_source)
33 +    {
34 +      msg_error("Internal error, internal() GSource was duplicated, this is bad", NULL);
35 +      g_assert_not_reached();
36 +      return FALSE;
37 +    }
38 +    
39    /* the source added below references this logreader, it will be unref'd
40       when the source is destroyed */ 
41    self->watch = afinter_source_watch_new(&self->super.super, cfg->mark_freq);
42    g_source_attach(self->watch, NULL);
43 +  global_internal_source = self->watch;
44 +  cfg->internal_source_present = TRUE;
45    return TRUE;
46  }
47  
48 @@ -204,8 +221,13 @@ afinter_sd_init(LogPipe *s)
49  
50    log_source_options_init(&self->source_options, cfg, self->super.group);
51    self->source = afinter_source_new(self, &self->source_options);
52 +  if (!log_pipe_init(&self->source->super, cfg))
53 +    {
54 +      log_pipe_unref(&self->source->super);
55 +      self->source = NULL;
56 +      return FALSE;
57 +    }
58    log_pipe_append(&self->source->super, s);
59 -  log_pipe_init(&self->source->super, cfg);
60    return TRUE;
61  }
62  
63 diff --git a/src/cfg.h b/src/cfg.h
64 index 5e3f1bd..cc2005d 100644
65 --- a/src/cfg.h
66 +++ b/src/cfg.h
67 @@ -98,6 +98,7 @@ struct _GlobalConfig
68    
69    struct _LogTemplate *file_template;
70    struct _LogTemplate *proto_template;
71 +  gboolean internal_source_present;
72    
73    /* */
74    GHashTable *sources;
This page took 0.042972 seconds and 3 git commands to generate.