Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mike Perry
Tor
Commits
0bd25f5d
Commit
0bd25f5d
authored
Jan 02, 2006
by
Roger Dingledine
Browse files
save and validate TorVersion in the state file.
svn:r5694
parent
2efa0567
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/or/config.c
View file @
0bd25f5d
...
...
@@ -385,7 +385,7 @@ static config_format_t state_format = {
static
or_options_t
*
global_options
=
NULL
;
/** Name of most recently read torrc file. */
static
char
*
torrc_fname
=
NULL
;
/** Persist
a
nt serialized state. */
/** Persist
e
nt serialized state. */
static
or_state_t
*
global_state
=
NULL
;
/** DOCDOC */
static
addr_policy_t
*
reachable_addr_policy
=
NULL
;
...
...
@@ -3526,8 +3526,13 @@ static int
or_state_validate
(
or_state_t
*
old_state
,
or_state_t
*
state
)
{
const
char
*
err
;
tor_version_t
v
;
if
(
entry_nodes_parse_state
(
state
,
0
,
&
err
)
<
0
)
{
warn
(
LD_GENERAL
,
"Unable to parse helper nodes: %s"
,
err
);
warn
(
LD_GENERAL
,
"Unable to parse entry nodes: %s"
,
err
);
return
-
1
;
}
if
(
tor_version_parse
(
state
->
TorVersion
,
&
v
))
{
warn
(
LD_GENERAL
,
"Unable to parse Tor version '%s'"
,
state
->
TorVersion
);
return
-
1
;
}
return
0
;
...
...
@@ -3617,6 +3622,8 @@ or_state_save(void)
size_t
len
;
char
*
fname
;
tor_assert
(
global_state
);
entry_nodes_update_state
(
global_state
);
rep_hist_update_state
(
global_state
);
...
...
@@ -3624,6 +3631,8 @@ or_state_save(void)
return
0
;
global_state
->
LastWritten
=
time
(
NULL
);
tor_free
(
global_state
->
TorVersion
);
global_state
->
TorVersion
=
tor_strdup
(
"Tor "
VERSION
);
state
=
config_dump
(
&
state_format
,
global_state
,
0
);
len
=
strlen
(
state
)
+
128
;
contents
=
tor_malloc
(
len
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment