[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] [tor/master] Make sure we don't warn for libevent versions like 1.4.14b-stable



Author: Sebastian Hahn <sebastian@xxxxxxxxxxxxxx>
Date: Mon, 26 Jul 2010 06:40:44 +0200
Subject: Make sure we don't warn for libevent versions like 1.4.14b-stable
Commit: 6cee3d466d0b5109c0dd47623003cd28680faa9e

---
 changes/bug1731              |    5 +++++
 src/common/compat_libevent.c |   10 ++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)
 create mode 100644 changes/bug1731

diff --git a/changes/bug1731 b/changes/bug1731
new file mode 100644
index 0000000..6d484e3
--- /dev/null
+++ b/changes/bug1731
@@ -0,0 +1,5 @@
+  o Minor bugfixes:
+    - Our libevent version parsing code couldn't handle versions like
+      1.4.14b-stable and warned the user about using an old and broken
+      version of libevent. Treat 1.4.14b-stable like 1.4.14-stable when
+      parsing the version. Fixes bug 1731; bugfix on 0.2.2.1-alpha.
diff --git a/src/common/compat_libevent.c b/src/common/compat_libevent.c
index 5cdd687..140b655 100644
--- a/src/common/compat_libevent.c
+++ b/src/common/compat_libevent.c
@@ -229,13 +229,15 @@ static le_version_t
 tor_decode_libevent_version(const char *v)
 {
   unsigned major, minor, patchlevel;
-  char c, extra;
+  char c, e, extra;
   int fields;
 
-  /* Try the new preferred "1.4.11-stable" format. */
-  fields = sscanf(v, "%u.%u.%u%c", &major, &minor, &patchlevel, &c);
+  /* Try the new preferred "1.4.11-stable" format.
+   * Also accept "1.4.14b-stable". */
+  fields = sscanf(v, "%u.%u.%u%c%c", &major, &minor, &patchlevel, &c, &e);
   if (fields == 3 ||
-      (fields == 4 && (c == '-' || c == '_'))) {
+      ((fields == 4 || fields == 5 ) && (c == '-' || c == '_')) ||
+      (fields == 5 && TOR_ISALPHA(c) && (e == '-' || e == '_'))) {
     return V(major,minor,patchlevel);
   }
 
-- 
1.7.1