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
ec4b01c0
Unverified
Commit
ec4b01c0
authored
Nov 30, 2018
by
Christian Brauner
Committed by
GitHub
Nov 30, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2740 from CameronNemo/usernsexec
lxc-usernsexec: fix default map functionality
parents
b8f44de3
c14ea11d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
14 deletions
+20
-14
lxc_usernsexec.c
src/lxc/cmd/lxc_usernsexec.c
+20
-14
No files found.
src/lxc/cmd/lxc_usernsexec.c
View file @
ec4b01c0
...
@@ -200,6 +200,7 @@ static int read_default_map(char *fnam, int which, char *user)
...
@@ -200,6 +200,7 @@ static int read_default_map(char *fnam, int which, char *user)
{
{
size_t
len
;
size_t
len
;
char
*
p1
,
*
p2
;
char
*
p1
,
*
p2
;
unsigned
long
ul1
,
ul2
;
FILE
*
fin
;
FILE
*
fin
;
int
ret
=
-
1
;
int
ret
=
-
1
;
size_t
sz
=
0
;
size_t
sz
=
0
;
...
@@ -224,37 +225,42 @@ static int read_default_map(char *fnam, int which, char *user)
...
@@ -224,37 +225,42 @@ static int read_default_map(char *fnam, int which, char *user)
if
(
!
p2
)
if
(
!
p2
)
continue
;
continue
;
newmap
=
malloc
(
sizeof
(
*
newmap
));
line
[
strlen
(
line
)
-
1
]
=
'\0'
;
if
(
!
newmap
)
*
p2
=
'\0'
;
goto
on_error
;
ret
=
lxc_safe_ulong
(
p1
+
1
,
&
newmap
->
hostid
);
ret
=
lxc_safe_ulong
(
p1
+
1
,
&
ul1
);
if
(
ret
<
0
)
if
(
ret
<
0
)
goto
on_error
;
break
;
ret
=
lxc_safe_ulong
(
p2
+
1
,
&
newmap
->
range
);
ret
=
lxc_safe_ulong
(
p2
+
1
,
&
ul2
);
if
(
ret
<
0
)
if
(
ret
<
0
)
goto
on_error
;
break
;
ret
=
-
1
;
newmap
=
malloc
(
sizeof
(
*
newmap
));
if
(
!
newmap
)
break
;
newmap
->
nsid
=
0
;
newmap
->
nsid
=
0
;
newmap
->
idtype
=
which
;
newmap
->
idtype
=
which
;
newmap
->
hostid
=
ul1
;
newmap
->
range
=
ul2
;
ret
=
-
1
;
tmp
=
malloc
(
sizeof
(
*
tmp
));
tmp
=
malloc
(
sizeof
(
*
tmp
));
if
(
!
tmp
)
if
(
!
tmp
)
{
goto
on_error
;
free
(
newmap
);
break
;
}
tmp
->
elem
=
newmap
;
tmp
->
elem
=
newmap
;
lxc_list_add_tail
(
&
active_map
,
tmp
);
lxc_list_add_tail
(
&
active_map
,
tmp
);
ret
=
0
;
break
;
break
;
}
}
ret
=
0
;
on_error:
fclose
(
fin
);
fclose
(
fin
);
free
(
line
);
free
(
line
);
free
(
newmap
);
return
ret
;
return
ret
;
}
}
...
...
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