Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Core
Tor
Commits
edde1a78
Commit
edde1a78
authored
9 years ago
by
Nick Mathewson
Browse files
Options
Downloads
Plain Diff
Merge branch 'bug15541_squashed'
parents
1457364c
6b0c443d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
changes/bug15541
+5
-0
5 additions, 0 deletions
changes/bug15541
src/or/config.c
+32
-21
32 additions, 21 deletions
src/or/config.c
src/or/main.c
+4
-2
4 additions, 2 deletions
src/or/main.c
with
41 additions
and
23 deletions
changes/bug15541
0 → 100644
+
5
−
0
View file @
edde1a78
o Minor bugfixes (interface):
- Print usage information for --dump-config when it is used without
an argument. Also, fix the error message to use different wording
and add newline at the end. Fixes bug 15541; bugfix on 0.2.5.1-alpha.
This diff is collapsed.
Click to expand it.
src/or/config.c
+
32
−
21
View file @
edde1a78
...
...
@@ -1868,27 +1868,33 @@ options_act(const or_options_t *old_options)
return
0
;
}
typedef
enum
{
TAKES_NO_ARGUMENT
=
0
,
ARGUMENT_NECESSARY
=
1
,
ARGUMENT_OPTIONAL
=
2
}
takes_argument_t
;
static
const
struct
{
const
char
*
name
;
in
t
takes_argument
;
takes_argument_
t
takes_argument
;
}
CMDLINE_ONLY_OPTIONS
[]
=
{
{
"-f"
,
1
},
{
"--allow-missing-torrc"
,
0
},
{
"--defaults-torrc"
,
1
},
{
"--hash-password"
,
1
},
{
"--dump-config"
,
1
},
{
"--list-fingerprint"
,
0
},
{
"--verify-config"
,
0
},
{
"--ignore-missing-torrc"
,
0
},
{
"--quiet"
,
0
},
{
"--hush"
,
0
},
{
"--version"
,
0
},
{
"--library-versions"
,
0
},
{
"-h"
,
0
},
{
"--help"
,
0
},
{
"--list-torrc-options"
,
0
},
{
"--nt-service"
,
0
},
{
"-nt-service"
,
0
},
{
"-f"
,
ARGUMENT_NECESSARY
},
{
"--allow-missing-torrc"
,
TAKES_NO_ARGUMENT
},
{
"--defaults-torrc"
,
ARGUMENT_NECESSARY
},
{
"--hash-password"
,
ARGUMENT_NECESSARY
},
{
"--dump-config"
,
ARGUMENT_OPTIONAL
},
{
"--list-fingerprint"
,
TAKES_NO_ARGUMENT
},
{
"--verify-config"
,
TAKES_NO_ARGUMENT
},
{
"--ignore-missing-torrc"
,
TAKES_NO_ARGUMENT
},
{
"--quiet"
,
TAKES_NO_ARGUMENT
},
{
"--hush"
,
TAKES_NO_ARGUMENT
},
{
"--version"
,
TAKES_NO_ARGUMENT
},
{
"--library-versions"
,
TAKES_NO_ARGUMENT
},
{
"-h"
,
TAKES_NO_ARGUMENT
},
{
"--help"
,
TAKES_NO_ARGUMENT
},
{
"--list-torrc-options"
,
TAKES_NO_ARGUMENT
},
{
"--nt-service"
,
TAKES_NO_ARGUMENT
},
{
"-nt-service"
,
TAKES_NO_ARGUMENT
},
{
NULL
,
0
},
};
...
...
@@ -1915,7 +1921,7 @@ config_parse_commandline(int argc, char **argv, int ignore_errors,
while
(
i
<
argc
)
{
unsigned
command
=
CONFIG_LINE_NORMAL
;
int
want_arg
=
1
;
takes_argument_t
want_arg
=
ARGUMENT_NECESSARY
;
int
is_cmdline
=
0
;
int
j
;
...
...
@@ -1945,7 +1951,9 @@ config_parse_commandline(int argc, char **argv, int ignore_errors,
want_arg
=
0
;
}
if
(
want_arg
&&
i
==
argc
-
1
)
{
const
int
is_last
=
(
i
==
argc
-
1
);
if
(
want_arg
==
ARGUMENT_NECESSARY
&&
is_last
)
{
if
(
ignore_errors
)
{
arg
=
strdup
(
""
);
}
else
{
...
...
@@ -1955,8 +1963,11 @@ config_parse_commandline(int argc, char **argv, int ignore_errors,
config_free_lines
(
front_cmdline
);
return
-
1
;
}
}
else
if
(
want_arg
==
ARGUMENT_OPTIONAL
&&
is_last
)
{
arg
=
tor_strdup
(
""
);
}
else
{
arg
=
want_arg
?
tor_strdup
(
argv
[
i
+
1
])
:
strdup
(
""
);
arg
=
(
want_arg
!=
TAKES_NO_ARGUMENT
)
?
tor_strdup
(
argv
[
i
+
1
])
:
tor_strdup
(
""
);
}
param
=
tor_malloc_zero
(
sizeof
(
config_line_t
));
...
...
This diff is collapsed.
Click to expand it.
src/or/main.c
+
4
−
2
View file @
edde1a78
...
...
@@ -2803,6 +2803,7 @@ do_dump_config(void)
const
char
*
arg
=
options
->
command_arg
;
int
how
;
char
*
opts
;
if
(
!
strcmp
(
arg
,
"short"
))
{
how
=
OPTIONS_DUMP_MINIMAL
;
}
else
if
(
!
strcmp
(
arg
,
"non-builtin"
))
{
...
...
@@ -2810,8 +2811,9 @@ do_dump_config(void)
}
else
if
(
!
strcmp
(
arg
,
"full"
))
{
how
=
OPTIONS_DUMP_ALL
;
}
else
{
fprintf
(
stderr
,
"%s is not a recognized argument to --dump-config. "
"Please select 'short', 'non-builtin', or 'full'"
,
arg
);
fprintf
(
stderr
,
"No valid argument to --dump-config found!
\n
"
);
fprintf
(
stderr
,
"Please select 'short', 'non-builtin', or 'full'.
\n
"
);
return
-
1
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment