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
349df8e3
Unverified
Commit
349df8e3
authored
Aug 20, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd: use goto for cleanup in lxc-usernsexec
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
0cf1cbf2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
25 deletions
+17
-25
lxc_usernsexec.c
src/lxc/cmd/lxc_usernsexec.c
+17
-25
No files found.
src/lxc/cmd/lxc_usernsexec.c
View file @
349df8e3
...
...
@@ -196,14 +196,14 @@ static int parse_map(char *map)
*/
static
int
read_default_map
(
char
*
fnam
,
int
which
,
char
*
user
)
{
int
ret
;
size_t
len
;
char
*
p1
,
*
p2
;
FILE
*
fin
;
struct
id_map
*
newmap
;
int
ret
=
-
1
;
size_t
sz
=
0
;
char
*
line
=
NULL
;
struct
lxc_list
*
tmp
=
NULL
;
struct
id_map
*
newmap
=
NULL
;
fin
=
fopen
(
fnam
,
"r"
);
if
(
!
fin
)
...
...
@@ -223,46 +223,38 @@ static int read_default_map(char *fnam, int which, char *user)
continue
;
newmap
=
malloc
(
sizeof
(
*
newmap
));
if
(
!
newmap
)
{
fclose
(
fin
);
free
(
line
);
return
-
1
;
}
if
(
!
newmap
)
goto
on_error
;
ret
=
lxc_safe_ulong
(
p1
+
1
,
&
newmap
->
hostid
);
if
(
ret
<
0
)
{
fclose
(
fin
);
free
(
line
);
return
-
1
;
}
if
(
ret
<
0
)
goto
on_error
;
ret
=
lxc_safe_ulong
(
p2
+
1
,
&
newmap
->
range
);
if
(
ret
<
0
)
{
fclose
(
fin
);
free
(
line
);
return
-
1
;
}
if
(
ret
<
0
)
goto
on_error
;
newmap
->
nsid
=
0
;
newmap
->
idtype
=
which
;
ret
=
-
1
;
tmp
=
malloc
(
sizeof
(
*
tmp
));
if
(
!
tmp
)
{
fclose
(
fin
);
free
(
line
);
free
(
newmap
);
return
-
1
;
}
if
(
!
tmp
)
goto
on_error
;
tmp
->
elem
=
newmap
;
lxc_list_add_tail
(
&
active_map
,
tmp
);
break
;
}
free
(
line
);
ret
=
0
;
on_error:
fclose
(
fin
);
free
(
line
);
free
(
newmap
);
return
0
;
return
ret
;
}
static
int
find_default_map
(
void
)
...
...
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