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
947fd064
Commit
947fd064
authored
Mar 10, 2008
by
Peter Palfrader
Browse files
Store options we got from commandline seperately from bare argv/argc
svn:r13945
parent
00d64fd2
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/or/config.c
View file @
947fd064
...
...
@@ -705,6 +705,8 @@ static or_options_t *global_options = NULL;
static
char
*
torrc_fname
=
NULL
;
/** Persistent serialized state. */
static
or_state_t
*
global_state
=
NULL
;
/** Configuration Options set by command line. */
static
config_line_t
*
global_cmdline_options
=
NULL
;
/** Allocate an empty configuration object of a given format type. */
static
void
*
...
...
@@ -784,6 +786,10 @@ config_free_all(void)
config_free
(
&
state_format
,
global_state
);
global_state
=
NULL
;
}
if
(
global_cmdline_options
)
{
config_free_lines
(
global_cmdline_options
);
global_cmdline_options
=
NULL
;
}
tor_free
(
torrc_fname
);
tor_free
(
_version
);
}
...
...
@@ -3621,7 +3627,7 @@ load_torrc_from_disk(int argc, char **argv)
int
options_init_from_torrc
(
int
argc
,
char
**
argv
)
{
or_options_t
*
oldoptions
,
*
newoptions
;
or_options_t
*
oldoptions
,
*
newoptions
=
NULL
;
config_line_t
*
cl
;
char
*
cf
=
NULL
,
*
errmsg
=
NULL
;
int
i
,
retval
;
...
...
@@ -3655,6 +3661,15 @@ options_init_from_torrc(int argc, char **argv)
exit
(
0
);
}
/* Go through command-line variables */
if
(
!
global_cmdline_options
)
{
/* Or we could redo the list every time we pass this place.
* It does not really matter */
if
(
config_get_commandlines
(
argc
,
argv
,
&
global_cmdline_options
)
<
0
)
{
goto
err
;
}
}
newoptions
=
tor_malloc_zero
(
sizeof
(
or_options_t
));
newoptions
->
_magic
=
OR_OPTIONS_MAGIC
;
options_init
(
newoptions
);
...
...
@@ -3687,10 +3702,8 @@ options_init_from_torrc(int argc, char **argv)
goto
err
;
/* Go through command-line variables too */
if
(
config_get_commandlines
(
argc
,
argv
,
&
cl
)
<
0
)
goto
err
;
retval
=
config_assign
(
&
options_format
,
newoptions
,
cl
,
0
,
0
,
&
errmsg
);
config_free_lines
(
cl
);
retval
=
config_assign
(
&
options_format
,
newoptions
,
global_cmdline_options
,
0
,
0
,
&
errmsg
);
if
(
retval
<
0
)
goto
err
;
...
...
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