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
5a7f1dc6
Unverified
Commit
5a7f1dc6
authored
Feb 05, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
utils: rework lxc_setgroups()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
8917c382
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
utils.c
src/lxc/utils.c
+11
-5
utils.h
src/lxc/utils.h
+1
-1
No files found.
src/lxc/utils.c
View file @
5a7f1dc6
...
...
@@ -1454,14 +1454,20 @@ bool lxc_drop_groups(void)
return
ret
==
0
;
}
bool
lxc_setgroups
(
int
size
,
gid_t
list
[]
)
bool
lxc_setgroups
(
gid_t
list
[],
size_t
size
)
{
if
(
setgroups
(
size
,
list
)
<
0
)
{
SYSERROR
(
"Failed to setgroups()"
);
return
false
;
int
ret
;
ret
=
setgroups
(
size
,
list
);
if
(
ret
)
return
log_error_errno
(
false
,
errno
,
"Failed to set supplimentary groups"
);
if
(
size
>
0
&&
lxc_log_trace
())
{
for
(
size_t
i
=
0
;
i
<
size
;
i
++
)
TRACE
(
"Setting supplimentary group %d"
,
list
[
i
]);
}
NOTICE
(
"Dropped additional groups"
);
NOTICE
(
"Set supplimentary groups"
);
return
true
;
}
...
...
src/lxc/utils.h
View file @
5a7f1dc6
...
...
@@ -156,7 +156,7 @@ __hidden extern bool task_blocks_signal(pid_t pid, int signal);
* If LXC_INVALID_{G,U}ID is passed then the set{g,u}id() will not be called.
*/
__hidden
extern
bool
lxc_switch_uid_gid
(
uid_t
uid
,
gid_t
gid
);
__hidden
extern
bool
lxc_setgroups
(
int
size
,
gid_t
list
[]
);
__hidden
extern
bool
lxc_setgroups
(
gid_t
list
[],
size_t
size
);
__hidden
extern
bool
lxc_drop_groups
(
void
);
/* Find an unused loop device and associate it with source. */
...
...
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