Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
1a82981d
Commit
1a82981d
authored
7 years ago
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test/read_conf: validate the setting name early
parent
0ff0aca2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
read_conf.cxx
test/read_conf.cxx
+6
-4
No files found.
test/read_conf.cxx
View file @
1a82981d
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include "fs/Path.hxx"
#include "fs/Path.hxx"
#include "fs/Path.hxx"
#include "fs/Path.hxx"
#include "util/PrintException.hxx"
#include "util/PrintException.hxx"
#include "util/RuntimeError.hxx"
#include <assert.h>
#include <assert.h>
#include <stdio.h>
#include <stdio.h>
...
@@ -37,14 +38,15 @@ try {
...
@@ -37,14 +38,15 @@ try {
const
Path
config_path
=
Path
::
FromFS
(
argv
[
1
]);
const
Path
config_path
=
Path
::
FromFS
(
argv
[
1
]);
const
char
*
name
=
argv
[
2
];
const
char
*
name
=
argv
[
2
];
const
auto
option
=
ParseConfigOptionName
(
name
);
if
(
option
==
ConfigOption
::
MAX
)
throw
FormatRuntimeError
(
"Unknown setting: %s"
,
name
);
config_global_init
();
config_global_init
();
ReadConfigFile
(
config_path
);
ReadConfigFile
(
config_path
);
ConfigOption
option
=
ParseConfigOptionName
(
name
);
const
char
*
value
=
config_get_string
(
option
);
const
char
*
value
=
option
!=
ConfigOption
::
MAX
?
config_get_string
(
option
)
:
nullptr
;
int
ret
;
int
ret
;
if
(
value
!=
NULL
)
{
if
(
value
!=
NULL
)
{
printf
(
"%s
\n
"
,
value
);
printf
(
"%s
\n
"
,
value
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
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