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
d1673d63
Commit
d1673d63
authored
Jul 07, 2018
by
2xsec
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: lxc-unshare: replace converting standard identifiers of namespaces to api
Signed-off-by:
2xsec
<
dh48.jeong@samsung.com
>
parent
2d33090f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
25 deletions
+2
-25
lxc_unshare.c
src/lxc/tools/lxc_unshare.c
+2
-25
No files found.
src/lxc/tools/lxc_unshare.c
View file @
d1673d63
...
@@ -244,8 +244,7 @@ static int write_id_mapping(pid_t pid, const char *buf, size_t buf_size)
...
@@ -244,8 +244,7 @@ static int write_id_mapping(pid_t pid, const char *buf, size_t buf_size)
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
char
*
del
;
char
**
args
;
char
**
it
,
**
args
;
int
opt
;
int
opt
;
int
ret
;
int
ret
;
char
*
namespaces
=
NULL
;
char
*
namespaces
=
NULL
;
...
@@ -308,31 +307,9 @@ int main(int argc, char *argv[])
...
@@ -308,31 +307,9 @@ int main(int argc, char *argv[])
if
(
ret
)
if
(
ret
)
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
/* The identifiers for namespaces used with lxc-unshare as given on the
if
(
lxc_namespace_2_std_identifiers
(
namespaces
)
<
0
)
* manpage do not align with the standard identifiers. This affects
* network, mount, and uts namespaces. The standard identifiers are:
* "mnt", "uts", and "net" whereas lxc-unshare uses "MOUNT", "UTSNAME",
* and "NETWORK". So let's use some cheap memmove()s to replace them by
* their standard identifiers. Let's illustrate this with an example:
* Assume the string:
*
* "IPC|MOUNT|PID"
*
* then we memmove()
*
* dest: del + 1 == OUNT|PID
* src: del + 3 == NT|PID
*/
if
(
!
namespaces
)
usage
(
argv
[
0
]);
usage
(
argv
[
0
]);
while
((
del
=
strstr
(
namespaces
,
"MOUNT"
)))
memmove
(
del
+
1
,
del
+
3
,
strlen
(
del
)
-
2
);
for
(
it
=
(
char
*
[]){
"NETWORK"
,
"UTSNAME"
,
NULL
};
it
&&
*
it
;
it
++
)
while
((
del
=
strstr
(
namespaces
,
*
it
)))
memmove
(
del
+
3
,
del
+
7
,
strlen
(
del
)
-
6
);
ret
=
lxc_fill_namespace_flags
(
namespaces
,
&
flags
);
ret
=
lxc_fill_namespace_flags
(
namespaces
,
&
flags
);
if
(
ret
)
if
(
ret
)
usage
(
argv
[
0
]);
usage
(
argv
[
0
]);
...
...
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