Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
6a3b5795
Unverified
Commit
6a3b5795
authored
Mar 26, 2021
by
Stéphane Graber
Committed by
GitHub
Mar 26, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3734 from brauner/2021-03-26/fixes_2
confile: be stricter in config helpers
parents
0912bf6b
d60ba568
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
confile.c
src/lxc/confile.c
+13
-4
No files found.
src/lxc/confile.c
View file @
6a3b5795
...
...
@@ -2878,6 +2878,9 @@ static int parse_line(char *buffer, void *data)
char
*
dup
=
buffer
;
struct
parse_line_conf
*
plc
=
data
;
if
(
!
plc
->
conf
)
return
syserror_set
(
-
EINVAL
,
"Missing config"
);
/* If there are newlines in the config file we should keep them. */
empty_line
=
lxc_is_line_empty
(
dup
);
if
(
empty_line
)
...
...
@@ -2947,6 +2950,9 @@ static struct new_config_item *parse_new_conf_line(char *buffer)
char
*
dup
=
buffer
;
char
*
dot
,
*
key
,
*
line
,
*
value
;
if
(
is_empty_string
(
buffer
))
return
log_error_errno
(
NULL
,
EINVAL
,
"Empty configuration line"
);
linep
=
line
=
strdup
(
dup
);
if
(
!
line
)
return
NULL
;
...
...
@@ -2999,16 +3005,19 @@ static struct new_config_item *parse_new_conf_line(char *buffer)
int
lxc_config_read
(
const
char
*
file
,
struct
lxc_conf
*
conf
,
bool
from_include
)
{
struct
parse_line_conf
c
;
struct
parse_line_conf
plc
;
if
(
!
conf
)
return
syserror_set
(
-
EINVAL
,
"Missing config"
);
c
.
conf
=
conf
;
c
.
from_include
=
from_include
;
pl
c
.
conf
=
conf
;
pl
c
.
from_include
=
from_include
;
/* Catch only the top level config file name in the structure. */
if
(
!
conf
->
rcfile
)
conf
->
rcfile
=
strdup
(
file
);
return
lxc_file_for_each_line_mmap
(
file
,
parse_line
,
&
c
);
return
lxc_file_for_each_line_mmap
(
file
,
parse_line
,
&
pl
c
);
}
int
lxc_config_define_add
(
struct
lxc_list
*
defines
,
char
*
arg
)
...
...
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