1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
## 01-config-version.patch.dpatch by Laszlo Boszormenyi (GCS) <gcs@debian.hu> .
4
## All lines beginning with `## DP:' are a description of the patch.
5
## DP: Correct config file version detection with a patch from upstream.
8
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' syslog-ng-3.1.2~/src/cfg.c syslog-ng-3.1.2/src/cfg.c
9
--- syslog-ng-3.1.2~/src/cfg.c 2010-05-08 20:47:57.000000000 +0200
10
+++ syslog-ng-3.1.2/src/cfg.c 2010-11-14 12:32:51.683320000 +0100
18
cfg_ts_format_value(gchar *format)
23
- gchar *pragma, *value, *colon, *eol, *p;
24
+ gchar *pragma, *value, *colon, *eol, *p, *end;
26
+ guint8 major, minor;
28
start_ofs = ftell(cfg);
29
p = fgets(line, sizeof(line), cfg);
31
if (strcmp(pragma, "version") == 0)
33
/* version number of the configuration file */
34
- if (strcmp(value, "3.0") == 0)
35
- self->version = 0x0300;
36
- else if (strncmp(value, "2.", 2) == 0)
37
- self->version = 0x0201;
38
+ p = strchr(value, '.');
41
+ major = strtol(value, &end, 10);
44
+ minor = strtol(p+1, &end, 10);
47
+ self->version = (major << 8) + minor;