diff options
Diffstat (limited to 'src/or/config.c')
-rw-r--r-- | src/or/config.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/or/config.c b/src/or/config.c index d11835463b..dcc57f8e77 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -783,6 +783,7 @@ extern const char tor_git_revision[]; /* from tor_main.c */ /** The version of this Tor process, as parsed. */ static char *the_tor_version = NULL; +static char *the_short_tor_version = NULL; /** Return the current Tor version. */ const char * @@ -790,14 +791,31 @@ get_version(void) { if (the_tor_version == NULL) { if (strlen(tor_git_revision)) { - tor_asprintf(&the_tor_version, "%s (git-%s)", VERSION, tor_git_revision); + tor_asprintf(&the_tor_version, "%s (git-%s)", get_short_version(), + tor_git_revision); } else { - the_tor_version = tor_strdup(VERSION); + the_tor_version = tor_strdup(get_short_version()); } } return the_tor_version; } +/** Return the current Tor version, without any git tag. */ +const char * +get_short_version(void) +{ + + if (the_short_tor_version == NULL) { +#ifdef TOR_BUILD_TAG + tor_asprintf(&the_short_tor_version, "%s (%s)", VERSION, TOR_BUILD_TAG); +#else + the_short_tor_version = tor_strdup(VERSION); +#endif + } + return the_short_tor_version; +} + + /** Release additional memory allocated in options */ static void |