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
85f839cc
Unverified
Commit
85f839cc
authored
May 25, 2018
by
Stéphane Graber
Committed by
GitHub
May 25, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2353 from brauner/2018-05-25/fix_lxc_create
tools: fix lxc-create with global config value II
parents
9acc50c1
3ec12d39
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
25 deletions
+13
-25
cgfsng.c
src/lxc/cgroups/cgfsng.c
+1
-2
lxccontainer.c
src/lxc/lxccontainer.c
+2
-8
start.c
src/lxc/start.c
+2
-2
lxc_create.c
src/lxc/tools/lxc_create.c
+8
-13
No files found.
src/lxc/cgroups/cgfsng.c
View file @
85f839cc
...
...
@@ -1284,7 +1284,6 @@ static inline bool cgfsng_create(struct cgroup_ops *ops,
char
*
container_cgroup
,
*
offset
,
*
tmp
;
int
idx
=
0
;
struct
lxc_conf
*
conf
=
handler
->
conf
;
const
char
*
join_args
[]
=
{
conf
->
cgroup_meta
.
dir
,
handler
->
name
,
NULL
};
if
(
ops
->
container_cgroup
)
{
WARN
(
"cgfsng_create called a second time: %s"
,
ops
->
container_cgroup
);
...
...
@@ -1295,7 +1294,7 @@ static inline bool cgfsng_create(struct cgroup_ops *ops,
return
false
;
if
(
conf
->
cgroup_meta
.
dir
)
tmp
=
lxc_string_join
(
"/"
,
join_args
,
false
);
tmp
=
lxc_string_join
(
"/"
,
(
const
char
*
[]){
conf
->
cgroup_meta
.
dir
,
handler
->
name
,
NULL
}
,
false
);
else
tmp
=
lxc_string_replace
(
"%n"
,
handler
->
name
,
ops
->
cgroup_pattern
);
if
(
!
tmp
)
{
...
...
src/lxc/lxccontainer.c
View file @
85f839cc
...
...
@@ -1971,11 +1971,8 @@ static bool do_lxcapi_reboot2(struct lxc_container *c, int timeout)
}
TRACE
(
"Sent signal %d to pid %d"
,
rebootsignal
,
pid
);
if
(
timeout
==
0
)
{
if
(
state_client_fd
>=
0
)
close
(
state_client_fd
);
if
(
timeout
==
0
)
return
true
;
}
ret
=
lxc_cmd_sock_rcv_state
(
state_client_fd
,
timeout
);
close
(
state_client_fd
);
...
...
@@ -2044,11 +2041,8 @@ static bool do_lxcapi_shutdown(struct lxc_container *c, int timeout)
}
TRACE
(
"Sent signal %d to pid %d"
,
haltsignal
,
pid
);
if
(
timeout
==
0
)
{
if
(
state_client_fd
>=
0
)
close
(
state_client_fd
);
if
(
timeout
==
0
)
return
true
;
}
ret
=
lxc_cmd_sock_rcv_state
(
state_client_fd
,
timeout
);
close
(
state_client_fd
);
...
...
src/lxc/start.c
View file @
85f839cc
...
...
@@ -861,11 +861,11 @@ int lxc_init(const char *name, struct lxc_handler *handler)
return
0
;
out_restore_sigmask:
pthread_sigmask
(
SIG_SETMASK
,
&
handler
->
oldmask
,
NULL
);
(
void
)
pthread_sigmask
(
SIG_SETMASK
,
&
handler
->
oldmask
,
NULL
);
out_delete_tty:
lxc_delete_tty
(
&
conf
->
ttys
);
out_aborting:
lxc_set_state
(
name
,
handler
,
ABORTING
);
(
void
)
lxc_set_state
(
name
,
handler
,
ABORTING
);
out_close_maincmd_fd:
close
(
conf
->
maincmd_fd
);
conf
->
maincmd_fd
=
-
1
;
...
...
src/lxc/tools/lxc_create.c
View file @
85f839cc
...
...
@@ -267,24 +267,19 @@ int main(int argc, char *argv[])
exit
(
EXIT_FAILURE
);
}
if
(
geteuid
())
{
if
(
!
my_args
.
lxcpath
[
0
])
my_args
.
lxcpath
[
0
]
=
lxc_get_global_config_item
(
"lxc.lxcpath"
);
if
(
mkdir_p
(
my_args
.
lxcpath
[
0
],
0755
))
exit
(
EXIT_FAILURE
);
if
(
!
my_args
.
lxcpath
[
0
])
my_args
.
lxcpath
[
0
]
=
lxc_get_global_config_item
(
"lxc.lxcpath"
);
if
(
mkdir_p
(
my_args
.
lxcpath
[
0
],
0755
))
exit
(
EXIT_FAILURE
);
if
(
geteuid
())
if
(
access
(
my_args
.
lxcpath
[
0
],
O_RDONLY
)
<
0
)
{
fprintf
(
stderr
,
"You lack access to %s
\n
"
,
my_args
.
lxcpath
[
0
]);
fprintf
(
stderr
,
"You lack access to %s
\n
"
,
my_args
.
lxcpath
[
0
]);
exit
(
EXIT_FAILURE
);
}
if
(
strcmp
(
my_args
.
bdevtype
,
"dir"
)
&&
strcmp
(
my_args
.
bdevtype
,
"_unset"
)
&&
strcmp
(
my_args
.
bdevtype
,
"btrfs"
))
{
fprintf
(
stderr
,
"Unprivileged users cannot create %s containers.
\n
"
,
my_args
.
bdevtype
);
exit
(
EXIT_FAILURE
);
}
}
c
=
lxc_container_new
(
my_args
.
name
,
my_args
.
lxcpath
[
0
]);
if
(
!
c
)
{
...
...
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