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
2e373df3
Unverified
Commit
2e373df3
authored
Dec 08, 2020
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
confile: cleanup parse_line()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
8f204445
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
23 deletions
+13
-23
confile.c
src/lxc/confile.c
+13
-23
No files found.
src/lxc/confile.c
View file @
2e373df3
...
...
@@ -2799,10 +2799,11 @@ struct parse_line_conf {
static
int
parse_line
(
char
*
buffer
,
void
*
data
)
{
char
*
dot
,
*
key
,
*
line
,
*
linep
,
*
value
;
__do_free
char
*
linep
=
NULL
;
char
*
dot
,
*
key
,
*
line
,
*
value
;
bool
empty_line
;
struct
lxc_config_t
*
config
;
int
ret
=
0
;
int
ret
;
char
*
dup
=
buffer
;
struct
parse_line_conf
*
plc
=
data
;
...
...
@@ -2817,34 +2818,30 @@ static int parse_line(char *buffer, void *data)
*/
linep
=
line
=
strdup
(
dup
);
if
(
!
line
)
return
-
1
;
return
ret_errno
(
ENOMEM
)
;
if
(
!
plc
->
from_include
)
{
ret
=
append_unexp_config_line
(
line
,
plc
->
conf
);
if
(
ret
<
0
)
goto
on_error
;
return
ret
;
}
if
(
empty_line
)
goto
on_error
;
return
0
;
line
+=
lxc_char_left_gc
(
line
,
strlen
(
line
));
/* ignore comments */
if
(
line
[
0
]
==
'#'
)
goto
on_error
;
return
0
;
/* martian option - don't add it to the config itself */
if
(
strncmp
(
line
,
"lxc."
,
4
))
goto
on_error
;
ret
=
-
1
;
return
0
;
dot
=
strchr
(
line
,
'='
);
if
(
!
dot
)
{
ERROR
(
"Invalid configuration line: %s"
,
line
);
goto
on_error
;
}
if
(
!
dot
)
return
log_error_errno
(
-
EINVAL
,
EINVAL
,
"Invalid configuration line: %s"
,
line
);
*
dot
=
'\0'
;
value
=
dot
+
1
;
...
...
@@ -2866,17 +2863,10 @@ static int parse_line(char *buffer, void *data)
}
config
=
lxc_get_config
(
key
);
if
(
!
config
)
{
ERROR
(
"Unknown configuration key
\"
%s
\"
"
,
key
);
goto
on_error
;
}
ret
=
config
->
set
(
key
,
value
,
plc
->
conf
,
NULL
);
on_error:
free
(
linep
);
if
(
!
config
)
return
log_error_errno
(
-
EINVAL
,
EINVAL
,
"Unknown configuration key
\"
%s
\"
"
,
key
);
return
ret
;
return
config
->
set
(
key
,
value
,
plc
->
conf
,
NULL
)
;
}
static
struct
new_config_item
*
parse_new_conf_line
(
char
*
buffer
)
...
...
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