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
46b217d7
Unverified
Commit
46b217d7
authored
Jul 22, 2018
by
2xsec
Committed by
Christian Brauner
Jul 24, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change log macro of error case from lxc_ambient_caps_up/down
Signed-off-by:
2xsec
<
dh48.jeong@samsung.com
>
parent
8713009e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
caps.c
src/lxc/caps.c
+11
-4
start.c
src/lxc/start.c
+2
-2
No files found.
src/lxc/caps.c
View file @
46b217d7
...
@@ -114,7 +114,6 @@ int lxc_caps_up(void)
...
@@ -114,7 +114,6 @@ int lxc_caps_up(void)
}
}
for
(
cap
=
0
;
cap
<=
CAP_LAST_CAP
;
cap
++
)
{
for
(
cap
=
0
;
cap
<=
CAP_LAST_CAP
;
cap
++
)
{
cap_flag_value_t
flag
;
cap_flag_value_t
flag
;
ret
=
cap_get_flag
(
caps
,
cap
,
CAP_PERMITTED
,
&
flag
);
ret
=
cap_get_flag
(
caps
,
cap
,
CAP_PERMITTED
,
&
flag
);
...
@@ -201,8 +200,10 @@ int lxc_ambient_caps_up(void)
...
@@ -201,8 +200,10 @@ int lxc_ambient_caps_up(void)
}
}
cap_names
=
cap_to_text
(
caps
,
NULL
);
cap_names
=
cap_to_text
(
caps
,
NULL
);
if
(
!
cap_names
)
if
(
!
cap_names
)
{
SYSWARN
(
"Failed to convert capabilities %d"
,
cap
);
goto
out
;
goto
out
;
}
TRACE
(
"Raised %s in inheritable and ambient capability set"
,
cap_names
);
TRACE
(
"Raised %s in inheritable and ambient capability set"
,
cap_names
);
...
@@ -311,6 +312,7 @@ static int _real_caps_last_cap(void)
...
@@ -311,6 +312,7 @@ static int _real_caps_last_cap(void)
if
((
n
=
read
(
fd
,
buf
,
31
))
>=
0
)
{
if
((
n
=
read
(
fd
,
buf
,
31
))
>=
0
)
{
buf
[
n
]
=
'\0'
;
buf
[
n
]
=
'\0'
;
errno
=
0
;
errno
=
0
;
result
=
strtol
(
buf
,
&
ptr
,
10
);
result
=
strtol
(
buf
,
&
ptr
,
10
);
if
(
!
ptr
||
(
*
ptr
!=
'\0'
&&
*
ptr
!=
'\n'
)
||
errno
!=
0
)
if
(
!
ptr
||
(
*
ptr
!=
'\0'
&&
*
ptr
!=
'\n'
)
||
errno
!=
0
)
result
=
-
1
;
result
=
-
1
;
...
@@ -323,7 +325,10 @@ static int _real_caps_last_cap(void)
...
@@ -323,7 +325,10 @@ static int _real_caps_last_cap(void)
* each capability indiviually from the kernel */
* each capability indiviually from the kernel */
if
(
result
<
0
)
{
if
(
result
<
0
)
{
int
cap
=
0
;
int
cap
=
0
;
while
(
prctl
(
PR_CAPBSET_READ
,
cap
)
>=
0
)
cap
++
;
while
(
prctl
(
PR_CAPBSET_READ
,
cap
)
>=
0
)
cap
++
;
result
=
cap
-
1
;
result
=
cap
-
1
;
}
}
...
@@ -333,7 +338,9 @@ static int _real_caps_last_cap(void)
...
@@ -333,7 +338,9 @@ static int _real_caps_last_cap(void)
int
lxc_caps_last_cap
(
void
)
int
lxc_caps_last_cap
(
void
)
{
{
static
int
last_cap
=
-
1
;
static
int
last_cap
=
-
1
;
if
(
last_cap
<
0
)
last_cap
=
_real_caps_last_cap
();
if
(
last_cap
<
0
)
last_cap
=
_real_caps_last_cap
();
return
last_cap
;
return
last_cap
;
}
}
...
...
src/lxc/start.c
View file @
46b217d7
...
@@ -1074,7 +1074,7 @@ static int do_start(void *data)
...
@@ -1074,7 +1074,7 @@ static int do_start(void *data)
ret
=
lxc_ambient_caps_up
();
ret
=
lxc_ambient_caps_up
();
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
SYS
ERROR
(
"Failed to raise ambient capabilities"
);
ERROR
(
"Failed to raise ambient capabilities"
);
goto
out_warn_father
;
goto
out_warn_father
;
}
}
...
@@ -1379,7 +1379,7 @@ static int do_start(void *data)
...
@@ -1379,7 +1379,7 @@ static int do_start(void *data)
ret
=
lxc_ambient_caps_down
();
ret
=
lxc_ambient_caps_down
();
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
SYS
ERROR
(
"Failed to clear ambient capabilities"
);
ERROR
(
"Failed to clear ambient capabilities"
);
goto
out_warn_father
;
goto
out_warn_father
;
}
}
...
...
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