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
2b4cdcdb
Unverified
Commit
2b4cdcdb
authored
Dec 08, 2020
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
confile: cleanup parse_new_conf_line()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
2e373df3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
27 deletions
+16
-27
confile.c
src/lxc/confile.c
+16
-27
No files found.
src/lxc/confile.c
View file @
2b4cdcdb
...
@@ -2871,10 +2871,10 @@ static int parse_line(char *buffer, void *data)
...
@@ -2871,10 +2871,10 @@ static int parse_line(char *buffer, void *data)
static
struct
new_config_item
*
parse_new_conf_line
(
char
*
buffer
)
static
struct
new_config_item
*
parse_new_conf_line
(
char
*
buffer
)
{
{
char
*
dot
,
*
key
,
*
line
,
*
linep
,
*
value
;
__do_free
char
*
k
=
NULL
,
*
linep
=
NULL
,
*
v
=
NULL
;
int
ret
=
0
;
__do_free
struct
new_config_item
*
new
=
NULL
;
char
*
dup
=
buffer
;
char
*
dup
=
buffer
;
struct
new_config_item
*
new
=
NULL
;
char
*
dot
,
*
key
,
*
line
,
*
value
;
linep
=
line
=
strdup
(
dup
);
linep
=
line
=
strdup
(
dup
);
if
(
!
line
)
if
(
!
line
)
...
@@ -2884,14 +2884,11 @@ static struct new_config_item *parse_new_conf_line(char *buffer)
...
@@ -2884,14 +2884,11 @@ static struct new_config_item *parse_new_conf_line(char *buffer)
/* martian option - don't add it to the config itself */
/* martian option - don't add it to the config itself */
if
(
strncmp
(
line
,
"lxc."
,
4
))
if
(
strncmp
(
line
,
"lxc."
,
4
))
goto
on_error
;
return
0
;
ret
=
-
1
;
dot
=
strchr
(
line
,
'='
);
dot
=
strchr
(
line
,
'='
);
if
(
!
dot
)
{
if
(
!
dot
)
ERROR
(
"Invalid configuration item: %s"
,
line
);
return
log_error_errno
(
NULL
,
EINVAL
,
"Invalid configuration line: %s"
,
line
);
goto
on_error
;
}
*
dot
=
'\0'
;
*
dot
=
'\0'
;
value
=
dot
+
1
;
value
=
dot
+
1
;
...
@@ -2912,29 +2909,21 @@ static struct new_config_item *parse_new_conf_line(char *buffer)
...
@@ -2912,29 +2909,21 @@ static struct new_config_item *parse_new_conf_line(char *buffer)
}
}
}
}
ret
=
-
1
;
new
=
malloc
(
sizeof
(
struct
new_config_item
));
new
=
malloc
(
sizeof
(
struct
new_config_item
));
if
(
!
new
)
if
(
!
new
)
goto
on_error
;
return
NULL
;
new
->
key
=
strdup
(
key
);
new
->
val
=
strdup
(
value
);
if
(
!
new
->
val
||
!
new
->
key
)
goto
on_error
;
ret
=
0
;
on_error:
k
=
strdup
(
key
);
free
(
linep
);
if
(
!
k
)
return
NULL
;
if
(
ret
<
0
&&
new
)
{
v
=
strdup
(
value
);
free
(
new
->
key
);
if
(
!
v
)
free
(
new
->
val
);
return
NULL
;
free
(
new
);
new
=
NULL
;
}
return
new
;
new
->
key
=
move_ptr
(
k
);
new
->
val
=
move_ptr
(
v
);
return
move_ptr
(
new
);
}
}
int
lxc_config_read
(
const
char
*
file
,
struct
lxc_conf
*
conf
,
bool
from_include
)
int
lxc_config_read
(
const
char
*
file
,
struct
lxc_conf
*
conf
,
bool
from_include
)
...
...
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