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
cadbf1a7
Commit
cadbf1a7
authored
Feb 27, 2016
by
Serge Hallyn
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #857 from brauner/bugfix_branch
cgfs: don't chown/chmod/rm non-existing paths
parents
db6c9252
01d59fe5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
cgfs.c
src/lxc/cgfs.c
+6
-1
No files found.
src/lxc/cgfs.c
View file @
cadbf1a7
...
@@ -1811,6 +1811,8 @@ static int create_or_remove_cgroup(bool do_remove,
...
@@ -1811,6 +1811,8 @@ static int create_or_remove_cgroup(bool do_remove,
/* create or remove directory */
/* create or remove directory */
if
(
do_remove
)
{
if
(
do_remove
)
{
if
(
!
dir_exists
(
buf
))
return
0
;
if
(
recurse
)
if
(
recurse
)
r
=
cgroup_rmdir
(
buf
);
r
=
cgroup_rmdir
(
buf
);
else
else
...
@@ -2518,7 +2520,6 @@ static int chown_cgroup_wrapper(void *data)
...
@@ -2518,7 +2520,6 @@ static int chown_cgroup_wrapper(void *data)
uid_t
destuid
;
uid_t
destuid
;
char
*
fpath
;
char
*
fpath
;
if
(
setresgid
(
0
,
0
,
0
)
<
0
)
if
(
setresgid
(
0
,
0
,
0
)
<
0
)
SYSERROR
(
"Failed to setgid to 0"
);
SYSERROR
(
"Failed to setgid to 0"
);
if
(
setresuid
(
0
,
0
,
0
)
<
0
)
if
(
setresuid
(
0
,
0
,
0
)
<
0
)
...
@@ -2536,6 +2537,7 @@ static int chown_cgroup_wrapper(void *data)
...
@@ -2536,6 +2537,7 @@ static int chown_cgroup_wrapper(void *data)
if
(
chown
(
fpath
,
destuid
,
0
)
<
0
)
if
(
chown
(
fpath
,
destuid
,
0
)
<
0
)
SYSERROR
(
"Error chowning %s
\n
"
,
fpath
);
SYSERROR
(
"Error chowning %s
\n
"
,
fpath
);
free
(
fpath
);
free
(
fpath
);
fpath
=
lxc_append_paths
(
arg
->
cgroup_path
,
"cgroup.procs"
);
fpath
=
lxc_append_paths
(
arg
->
cgroup_path
,
"cgroup.procs"
);
if
(
!
fpath
)
if
(
!
fpath
)
return
-
1
;
return
-
1
;
...
@@ -2551,6 +2553,9 @@ static bool do_cgfs_chown(char *cgroup_path, struct lxc_conf *conf)
...
@@ -2551,6 +2553,9 @@ static bool do_cgfs_chown(char *cgroup_path, struct lxc_conf *conf)
struct
chown_data
data
;
struct
chown_data
data
;
char
*
fpath
;
char
*
fpath
;
if
(
!
dir_exists
(
cgroup_path
))
return
true
;
if
(
lxc_list_empty
(
&
conf
->
id_map
))
if
(
lxc_list_empty
(
&
conf
->
id_map
))
/* If there's no mapping then we don't need to chown */
/* If there's no mapping then we don't need to chown */
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