~ubuntu-branches/ubuntu/vivid/syslog-ng/vivid

« back to all changes in this revision

Viewing changes to debian/patches/01-config-version.patch

  • Committer: Bazaar Package Importer
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2010-11-14 07:53:04 UTC
  • Revision ID: james.westby@ubuntu.com-20101114075304-ry8d6k0fzrfwm250
Tags: 3.1.2-3
* Apply upstream patch for config file version detection.
* Correct debian/watch .

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh /usr/share/dpatch/dpatch-run
 
2
## 01-config-version.patch.dpatch by Laszlo Boszormenyi (GCS) <gcs@debian.hu> .
 
3
##
 
4
## All lines beginning with `## DP:' are a description of the patch.
 
5
## DP: Correct config file version detection with a patch from upstream.
 
6
 
 
7
@DPATCH@
 
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
 
11
@@ -38,6 +38,7 @@
 
12
 #include <signal.h>
 
13
 #include <stdio.h>
 
14
 #include <string.h>
 
15
+#include <stdlib.h>
 
16
 
 
17
 gint
 
18
 cfg_ts_format_value(gchar *format)
 
19
@@ -213,8 +214,9 @@
 
20
   self->version = 0;
 
21
   while (!feof(cfg))
 
22
     {
 
23
-      gchar *pragma, *value, *colon, *eol, *p;
 
24
+      gchar *pragma, *value, *colon, *eol, *p, *end;
 
25
       gchar line[1024];
 
26
+      guint8 major, minor;
 
27
 
 
28
       start_ofs = ftell(cfg);
 
29
       p = fgets(line, sizeof(line), cfg);
 
30
@@ -253,10 +255,19 @@
 
31
       if (strcmp(pragma, "version") == 0)
 
32
         {
 
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, '.');
 
39
+          if (p)
 
40
+            {
 
41
+              major = strtol(value, &end, 10);
 
42
+              if (end == p)
 
43
+                {
 
44
+                  minor = strtol(p+1, &end, 10);
 
45
+                  if (end)
 
46
+                    {
 
47
+                      self->version = (major << 8) + minor;
 
48
+                    }
 
49
+                }
 
50
+            }
 
51
         }
 
52
       else
 
53
         {