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
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
sergi
Tor
Commits
92fa5239
Unverified
Commit
92fa5239
authored
5 years ago
by
teor
Browse files
Options
Downloads
Patches
Plain Diff
control/getinfo: Use standard error handling
Use BUG() for coding errors, and `< 0` for error checks. Fix to 31684.
parent
3b2525c3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/feature/control/control_getinfo.c
+4
-5
4 additions, 5 deletions
src/feature/control/control_getinfo.c
with
4 additions
and
5 deletions
src/feature/control/control_getinfo.c
+
4
−
5
View file @
92fa5239
...
...
@@ -333,9 +333,8 @@ getinfo_helper_current_consensus(consensus_flavor_t flavor,
const
char
**
errmsg
)
{
const
char
*
flavor_name
=
networkstatus_get_flavor_name
(
flavor
);
if
(
!
strcmp
(
flavor_name
,
"??"
))
{
*
errmsg
=
"Could not open cached consensus. "
"Make sure FetchUselessDescriptors is set to 1."
;
if
(
BUG
(
!
strcmp
(
flavor_name
,
"??"
)))
{
*
errmsg
=
"Internal error: unrecognized flavor name."
;
return
-
1
;
}
if
(
we_want_to_fetch_flavor
(
get_options
(),
flavor
))
{
...
...
@@ -615,14 +614,14 @@ getinfo_helper_dir(control_connection_t *control_conn,
}
else
if
(
!
strcmp
(
question
,
"dir/status-vote/current/consensus"
))
{
int
consensus_result
=
getinfo_helper_current_consensus
(
FLAV_NS
,
answer
,
errmsg
);
if
(
consensus_result
==
-
1
)
{
if
(
consensus_result
<
0
)
{
return
-
1
;
}
}
else
if
(
!
strcmp
(
question
,
"dir/status-vote/current/consensus-microdesc"
))
{
int
consensus_result
=
getinfo_helper_current_consensus
(
FLAV_MICRODESC
,
answer
,
errmsg
);
if
(
consensus_result
==
-
1
)
{
if
(
consensus_result
<
0
)
{
return
-
1
;
}
}
else
if
(
!
strcmp
(
question
,
"network-status"
))
{
/* v1 */
...
...
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