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
f7cdc98a
Unverified
Commit
f7cdc98a
authored
Dec 08, 2019
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cgroups/cgfsng: rework cgfsng_escape()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
68990f1e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
10 deletions
+20
-10
cgfsng.c
src/lxc/cgroups/cgfsng.c
+20
-10
No files found.
src/lxc/cgroups/cgfsng.c
View file @
f7cdc98a
...
@@ -1930,23 +1930,33 @@ __cgfsng_ops static int cgfsng_nrtasks(struct cgroup_ops *ops)
...
@@ -1930,23 +1930,33 @@ __cgfsng_ops static int cgfsng_nrtasks(struct cgroup_ops *ops)
/* Only root needs to escape to the cgroup of its init. */
/* Only root needs to escape to the cgroup of its init. */
__cgfsng_ops
static
bool
cgfsng_escape
(
const
struct
cgroup_ops
*
ops
,
__cgfsng_ops
static
bool
cgfsng_escape
(
const
struct
cgroup_ops
*
ops
,
struct
lxc_conf
*
conf
)
struct
lxc_conf
*
conf
)
{
{
if
(
geteuid
()
||
!
ops
->
hierarchies
)
if
(
!
ops
)
return
ret_set_errno
(
false
,
ENOENT
);
if
(
!
ops
->
hierarchies
)
return
true
;
if
(
!
conf
)
return
ret_set_errno
(
false
,
EINVAL
);
if
(
geteuid
())
return
true
;
return
true
;
for
(
int
i
=
0
;
ops
->
hierarchies
[
i
];
i
++
)
{
for
(
int
i
=
0
;
ops
->
hierarchies
[
i
];
i
++
)
{
int
ret
;
__do_free
char
*
fullpath
=
NULL
;
__do_free
char
*
fullpath
=
NULL
;
int
ret
;
fullpath
=
must_make_path
(
ops
->
hierarchies
[
i
]
->
mountpoint
,
fullpath
=
ops
->
hierarchies
[
i
]
->
container_base_path
,
must_make_path
(
ops
->
hierarchies
[
i
]
->
mountpoint
,
"cgroup.procs"
,
NULL
);
ops
->
hierarchies
[
i
]
->
container_base_path
,
"cgroup.procs"
,
NULL
);
ret
=
lxc_write_to_file
(
fullpath
,
"0"
,
2
,
false
,
0666
);
ret
=
lxc_write_to_file
(
fullpath
,
"0"
,
2
,
false
,
0666
);
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
SYSERROR
(
"Failed to escape to cgroup
\"
%s
\"
"
,
fullpath
);
return
log_error_errno
(
false
,
return
false
;
errno
,
"Failed to escape to cgroup
\"
%s
\"
"
,
}
fullpath
);
}
}
return
true
;
return
true
;
...
...
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