Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Slurm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tud-zih-energy
Slurm
Commits
5042bab5
Commit
5042bab5
authored
6 years ago
by
Tim Wickberg
Browse files
Options
Downloads
Patches
Plain Diff
Add macOS block to fix warning for differences in getgrouplist().
getgrouplist() is not POSIX, so it varies between platforms.
parent
3095d9aa
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/common/group_cache.c
+9
-0
9 additions, 0 deletions
src/common/group_cache.c
src/plugins/mcs/group/mcs_group.c
+8
-0
8 additions, 0 deletions
src/plugins/mcs/group/mcs_group.c
with
17 additions
and
0 deletions
src/common/group_cache.c
+
9
−
0
View file @
5042bab5
...
...
@@ -166,8 +166,17 @@ static int _group_cache_lookup_internal(gids_cache_needle_t *needle, gid_t **gid
/* Cache lookup failed or entry value was too old, fetch new
* value and insert it into cache. */
#if defined(__APPLE__)
/*
* macOS has (int *) for the third argument instead
* of (gid_t *) like FreeBSD, NetBSD, and Linux.
*/
while
(
getgrouplist
(
entry
->
username
,
entry
->
gid
,
(
int
*
)
entry
->
gids
,
&
entry
->
ngids
)
==
-
1
)
{
#else
while
(
getgrouplist
(
entry
->
username
,
entry
->
gid
,
entry
->
gids
,
&
entry
->
ngids
)
==
-
1
)
{
#endif
/* group list larger than array, resize array to fit */
entry
->
gids
=
xrealloc
(
entry
->
gids
,
entry
->
ngids
*
sizeof
(
gid_t
));
...
...
This diff is collapsed.
Click to expand it.
src/plugins/mcs/group/mcs_group.c
+
8
−
0
View file @
5042bab5
...
...
@@ -127,7 +127,15 @@ static int _get_user_groups(uint32_t user_id, uint32_t group_id,
user_name
=
uid_to_string
((
uid_t
)
user_id
);
*
ngroups
=
max_groups
;
#if defined(__APPLE__)
/*
* macOS has (int *) for the third argument instead
* of (gid_t *) like FreeBSD, NetBSD, and Linux.
*/
rc
=
getgrouplist
(
user_name
,
(
gid_t
)
group_id
,
(
int
*
)
groups
,
ngroups
);
#else
rc
=
getgrouplist
(
user_name
,
(
gid_t
)
group_id
,
groups
,
ngroups
);
#endif
if
(
rc
<
0
)
{
error
(
"getgrouplist(%s): %m"
,
user_name
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment