[or-cvs] [tor/master] Add Windows version detection for Vista and 7

nickm at torproject.org nickm at torproject.org
Wed Feb 10 22:16:44 UTC 2010


Author: Sebastian Hahn <sebastian at torproject.org>
Date: Sun, 7 Feb 2010 05:18:50 +0100
Subject: Add Windows version detection for Vista and 7
Commit: fe1827556339130da9ade0b9e8e85952493a0aeb

Vista is Windows 6.0, and 7 is Windows 6.1. Fixes bug 1097.

Also fix a coding style violation.
---
 src/common/compat.c |    5 +++--
 src/or/config.c     |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/common/compat.c b/src/common/compat.c
index d45fda0..7295bf2 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -1613,7 +1613,8 @@ get_uname(void)
         static struct {
           unsigned major; unsigned minor; const char *version;
         } win_version_table[] = {
-          { 6, 0, "Windows \"Longhorn\"" },
+          { 6, 1, "Windows 7" },
+          { 6, 0, "Windows Vista" },
           { 5, 2, "Windows Server 2003" },
           { 5, 1, "Windows XP" },
           { 5, 0, "Windows 2000" },
@@ -1663,7 +1664,7 @@ get_uname(void)
                        plat, extra);
         } else {
           if (info.dwMajorVersion > 6 ||
-              (info.dwMajorVersion==6 && info.dwMinorVersion>0))
+              (info.dwMajorVersion==6 && info.dwMinorVersion>1))
             tor_snprintf(uname_result, sizeof(uname_result),
                       "Very recent version of Windows [major=%d,minor=%d] %s",
                       (int)info.dwMajorVersion,(int)info.dwMinorVersion,
diff --git a/src/or/config.c b/src/or/config.c
index 8421bfa..e544917 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -2223,7 +2223,7 @@ resolve_my_address(int warn_severity, or_options_t *options,
   if (tor_inet_aton(hostname, &in) == 0) {
     /* then we have to resolve it */
     explicit_ip = 0;
-    if(!tor_lookup_hostname(hostname, &addr)) {
+    if (!tor_lookup_hostname(hostname, &addr)) {
       uint32_t interface_ip;
 
       if (explicit_hostname) {
-- 
1.6.5



More information about the tor-commits mailing list