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
623cfa35
Unverified
Commit
623cfa35
authored
Jul 14, 2018
by
Christian Brauner
Committed by
GitHub
Jul 14, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2468 from 2xsec/bugfix
tools: lxc-unshare: apply argument parser of lxc and log system of lxc
parents
94fd0bd6
35bfea7a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
4 deletions
+18
-4
namespace.c
src/lxc/namespace.c
+4
-1
arguments.c
src/lxc/tools/arguments.c
+7
-2
arguments.h
src/lxc/tools/arguments.h
+7
-1
lxc_unshare.c
src/lxc/tools/lxc_unshare.c
+0
-0
No files found.
src/lxc/namespace.c
View file @
623cfa35
...
...
@@ -115,6 +115,7 @@ pid_t lxc_raw_clone(unsigned long flags)
:
"=r"
(
in_child
),
"=r"
(
child_pid
)
:
"i"
(
__NR_clone
),
"r"
(
flags
|
SIGCHLD
)
:
"%o1"
,
"%o0"
,
"%g1"
);
if
(
in_child
)
return
0
;
else
...
...
@@ -174,6 +175,7 @@ const struct ns_info ns_info[LXC_NS_MAX] = {
int
lxc_namespace_2_cloneflag
(
const
char
*
namespace
)
{
int
i
;
for
(
i
=
0
;
i
<
LXC_NS_MAX
;
i
++
)
if
(
!
strcasecmp
(
ns_info
[
i
].
proc_name
,
namespace
))
return
ns_info
[
i
].
clone_flag
;
...
...
@@ -185,6 +187,7 @@ int lxc_namespace_2_cloneflag(const char *namespace)
int
lxc_namespace_2_ns_idx
(
const
char
*
namespace
)
{
int
i
;
for
(
i
=
0
;
i
<
LXC_NS_MAX
;
i
++
)
if
(
!
strcmp
(
ns_info
[
i
].
proc_name
,
namespace
))
return
i
;
...
...
@@ -239,7 +242,6 @@ int lxc_fill_namespace_flags(char *flaglist, int *flags)
token
=
strtok_r
(
flaglist
,
"|"
,
&
saveptr
);
while
(
token
)
{
aflag
=
lxc_namespace_2_cloneflag
(
token
);
if
(
aflag
<
0
)
return
-
1
;
...
...
@@ -248,5 +250,6 @@ int lxc_fill_namespace_flags(char *flaglist, int *flags)
token
=
strtok_r
(
NULL
,
"|"
,
&
saveptr
);
}
return
0
;
}
src/lxc/tools/arguments.c
View file @
623cfa35
...
...
@@ -50,7 +50,6 @@ static int build_shortopts(const struct option *a_options, char *a_shortopts,
return
-
1
;
for
(
opt
=
a_options
;
opt
->
name
;
opt
++
)
{
if
(
!
isascii
(
opt
->
val
))
continue
;
...
...
@@ -163,6 +162,7 @@ See the %s man page for further information.\n\n",
if
(
args
->
helpfn
)
args
->
helpfn
(
args
);
exit
(
code
);
}
...
...
@@ -183,6 +183,7 @@ static int lxc_arguments_lxcpath_add(struct lxc_arguments *args,
lxc_error
(
args
,
"no memory"
);
return
-
ENOMEM
;
}
args
->
lxcpath
[
args
->
lxcpath_cnt
++
]
=
lxcpath
;
return
0
;
}
...
...
@@ -207,6 +208,7 @@ extern int lxc_arguments_parse(struct lxc_arguments *args, int argc,
c
=
getopt_long
(
argc
,
argv
,
shortopts
,
args
->
options
,
&
index
);
if
(
c
==
-
1
)
break
;
switch
(
c
)
{
case
'n'
:
args
->
name
=
optarg
;
...
...
@@ -261,7 +263,8 @@ extern int lxc_arguments_parse(struct lxc_arguments *args, int argc,
}
/* Check the command options */
if
(
!
args
->
name
&&
strcmp
(
args
->
progname
,
"lxc-autostart"
)
!=
0
)
{
if
(
!
args
->
name
&&
strncmp
(
args
->
progname
,
"lxc-autostart"
,
strlen
(
args
->
progname
))
!=
0
&&
strncmp
(
args
->
progname
,
"lxc-unshare"
,
strlen
(
args
->
progname
))
!=
0
)
{
if
(
args
->
argv
)
{
args
->
name
=
argv
[
optind
];
optind
++
;
...
...
@@ -277,9 +280,11 @@ extern int lxc_arguments_parse(struct lxc_arguments *args, int argc,
if
(
args
->
checker
)
ret
=
args
->
checker
(
args
);
error:
if
(
ret
)
lxc_error
(
args
,
"could not parse command line"
);
return
ret
;
}
...
...
src/lxc/tools/arguments.h
View file @
623cfa35
...
...
@@ -94,7 +94,7 @@ struct lxc_arguments {
char
*
rbdname
,
*
rbdpool
;
char
*
zfsroot
,
*
lowerdir
,
*
dir
;
/* lxc-execute */
/* lxc-execute
and lxc-unshare
*/
uid_t
uid
;
gid_t
gid
;
...
...
@@ -137,6 +137,12 @@ struct lxc_arguments {
/* lxc-copy */
bool
tmpfs
;
/* lxc-unshare */
int
flags
;
int
want_default_mounts
;
const
char
*
want_hostname
;
bool
setuid
;
/* remaining arguments */
char
*
const
*
argv
;
int
argc
;
...
...
src/lxc/tools/lxc_unshare.c
View file @
623cfa35
This diff is collapsed.
Click to expand it.
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