aboutsummaryrefslogtreecommitdiff
path: root/src/app/config
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-11-09 15:01:49 -0500
committerNick Mathewson <nickm@torproject.org>2018-11-09 15:01:49 -0500
commitbf4f55a13da783083b0c76decd6ebf475a63ebd0 (patch)
tree15ebd3463fc900d52cd3065b6c83cf83a364e3e7 /src/app/config
parent5d73f87cedaf58fd6e7a53a230b311f5e8b51b73 (diff)
parent60d10812368458cb88aa9f9d628c49766d4bb490 (diff)
downloadtor-bf4f55a13da783083b0c76decd6ebf475a63ebd0.tar.gz
tor-bf4f55a13da783083b0c76decd6ebf475a63ebd0.zip
Merge branch 'subsystems'
Diffstat (limited to 'src/app/config')
-rw-r--r--src/app/config/config.c46
-rw-r--r--src/app/config/config.h2
-rw-r--r--src/app/config/statefile.c1
3 files changed, 5 insertions, 44 deletions
diff --git a/src/app/config/config.c b/src/app/config/config.c
index 81cc3e378f..45a23d67d5 100644
--- a/src/app/config/config.c
+++ b/src/app/config/config.c
@@ -64,6 +64,7 @@
#include "app/config/confparse.h"
#include "app/config/statefile.h"
#include "app/main/main.h"
+#include "app/main/subsysmgr.h"
#include "core/mainloop/connection.h"
#include "core/mainloop/cpuworker.h"
#include "core/mainloop/mainloop.h"
@@ -112,9 +113,9 @@
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/crypt_ops/crypto_util.h"
#include "lib/encoding/confline.h"
-#include "lib/log/git_revision.h"
#include "lib/net/resolve.h"
#include "lib/sandbox/sandbox.h"
+#include "lib/version/torversion.h"
#ifdef ENABLE_NSS
#include "lib/crypt_ops/crypto_nss_mgt.h"
@@ -972,42 +973,6 @@ set_options(or_options_t *new_val, char **msg)
return 0;
}
-/** The version of this Tor process, as parsed. */
-static char *the_tor_version = NULL;
-/** A shorter version of this Tor process's version, for export in our router
- * descriptor. (Does not include the git version, if any.) */
-static char *the_short_tor_version = NULL;
-
-/** Return the current Tor version. */
-const char *
-get_version(void)
-{
- if (the_tor_version == NULL) {
- if (strlen(tor_git_revision)) {
- tor_asprintf(&the_tor_version, "%s (git-%s)", get_short_version(),
- tor_git_revision);
- } else {
- 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
@@ -1067,9 +1032,6 @@ config_free_all(void)
tor_free(torrc_defaults_fname);
tor_free(global_dirfrontpagecontents);
- tor_free(the_short_tor_version);
- tor_free(the_tor_version);
-
cleanup_protocol_warning_severity_level();
have_parsed_cmdline = 0;
@@ -1432,10 +1394,10 @@ options_act_reversible(const or_options_t *old_options, char **msg)
* processes. */
if (running_tor && options->RunAsDaemon) {
if (! start_daemon_has_been_called())
- crypto_prefork();
+ subsystems_prefork();
/* No need to roll back, since you can't change the value. */
if (start_daemon())
- crypto_postfork();
+ subsystems_postfork();
}
#ifdef HAVE_SYSTEMD
diff --git a/src/app/config/config.h b/src/app/config/config.h
index a169cfd451..4c497b83a6 100644
--- a/src/app/config/config.h
+++ b/src/app/config/config.h
@@ -41,8 +41,6 @@ const char *escaped_safe_str_client(const char *address);
const char *escaped_safe_str(const char *address);
void init_protocol_warning_severity_level(void);
int get_protocol_warning_severity_level(void);
-const char *get_version(void);
-const char *get_short_version(void);
/** An error from options_trial_assign() or options_init_from_string(). */
typedef enum setopt_err_t {
diff --git a/src/app/config/statefile.c b/src/app/config/statefile.c
index 8a8b7ced01..4ba7be1519 100644
--- a/src/app/config/statefile.c
+++ b/src/app/config/statefile.c
@@ -45,6 +45,7 @@
#include "app/config/statefile.h"
#include "lib/encoding/confline.h"
#include "lib/net/resolve.h"
+#include "lib/version/torversion.h"
#include "app/config/or_state_st.h"