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
08346f13
Commit
08346f13
authored
21 years ago
by
Roger Dingledine
Browse files
Options
Downloads
Patches
Plain Diff
make parse_line_from_file fail rather than warn for malformed lines
svn:r1193
parent
f81ad155
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/common/util.c
+5
-4
5 additions, 4 deletions
src/common/util.c
with
5 additions
and
4 deletions
src/common/util.c
+
5
−
4
View file @
08346f13
...
...
@@ -621,8 +621,9 @@ char *read_file_to_str(const char *filename) {
}
/* read lines from f (no more than maxlen-1 bytes each) until we
* get one with a well-formed "key value".
* point *key to the first word in line, point *value to the second.
* get a non-whitespace line. If it isn't of the form "key value"
* (value can have spaces), return -1.
* Point *key to the first word in line, point *value * to the second.
* Put a \0 at the end of key, remove everything at the end of value
* that is whitespace or comment.
* Return 1 if success, 0 if no more lines, -1 if error.
...
...
@@ -661,8 +662,8 @@ try_next_line:
if
(
!*
end
||
!*
value
)
{
/* only a key on this line. no value. */
*
end
=
0
;
log_fn
(
LOG_WARN
,
"Line has keyword '%s' but no value.
Skipp
ing."
,
key
);
goto
try_next_line
;
log_fn
(
LOG_WARN
,
"Line has keyword '%s' but no value.
Fail
ing."
,
key
);
return
-
1
;
}
*
end
=
0
;
/* null it out */
...
...
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