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
dd871fa0
Commit
dd871fa0
authored
Jul 30, 2017
by
Christian Brauner
Committed by
GitHub
Jul 30, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1720 from hallyn/2017-07-29/cg
Fix some bugs in #1719
parents
1135b35b
2c2d6c49
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
17 deletions
+17
-17
cgfsng.c
src/lxc/cgroups/cgfsng.c
+17
-17
No files found.
src/lxc/cgroups/cgfsng.c
View file @
dd871fa0
...
...
@@ -1904,11 +1904,10 @@ static int cgfsng_set(const char *filename, const char *value, const char *name,
*/
static
int
convert_devpath
(
const
char
*
invalue
,
char
*
dest
)
{
char
*
p
,
*
path
,
*
mode
,
type
=
0
;
char
*
p
,
*
path
,
*
mode
,
type
;
struct
stat
sb
;
unsigned
long
minor
,
major
;
int
n_parts
,
ret
;
dev_t
dev
;
int
n_parts
,
ret
=
-
EINVAL
;
path
=
must_copy_string
(
invalue
);
...
...
@@ -1918,25 +1917,27 @@ static int convert_devpath(const char *invalue, char *dest)
* is not legal, we could check for that if we cared to
*/
for
(
n_parts
=
1
,
p
=
path
;
*
p
&&
n_parts
<
3
;
p
++
)
{
if
(
*
p
==
' '
)
{
if
(
*
p
!=
' '
)
continue
;
*
p
=
'\0'
;
mode
=
p
+
1
;
if
(
n_parts
!=
1
)
break
;
p
++
;
n_parts
++
;
while
(
*
p
==
' '
)
p
++
;
}
}
if
(
n_parts
==
1
)
{
ret
=
-
EINVAL
;
mode
=
p
;
if
(
*
p
==
'\0'
)
goto
out
;
}
if
(
n_parts
==
1
)
goto
out
;
ret
=
stat
(
path
,
&
sb
);
if
(
ret
<
0
)
goto
out
;
dev
=
sb
.
st_rdev
;
mode_t
m
=
sb
.
st_mode
&
S_IFMT
;
switch
(
m
)
{
case
S_IFBLK
:
...
...
@@ -1945,16 +1946,15 @@ static int convert_devpath(const char *invalue, char *dest)
case
S_IFCHR
:
type
=
'c'
;
break
;
}
if
(
type
==
0
)
{
default:
ERROR
(
"Unsupported device type %i for %s"
,
m
,
path
);
ret
=
-
EINVAL
;
goto
out
;
}
major
=
MAJOR
(
dev
),
minor
=
MINOR
(
dev
);
ret
=
snprintf
(
dest
,
50
,
"%c %lu:%lu %s"
,
type
,
major
,
minor
,
mode
);
major
=
MAJOR
(
sb
.
st_rdev
);
minor
=
MINOR
(
sb
.
st_rdev
);
ret
=
snprintf
(
dest
,
50
,
"%c %lu:%lu %s"
,
type
,
major
,
minor
,
mode
);
if
(
ret
<
0
||
ret
>=
50
)
{
ERROR
(
"Error on configuration value
\"
%c %lu:%lu %s
\"
(max 50 chars)"
,
type
,
major
,
minor
,
mode
);
...
...
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