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
2a674aee
Commit
2a674aee
authored
11 years ago
by
David Bigagli
Browse files
Options
Downloads
Patches
Plain Diff
Handle the case in which errno is not reset to 0 after calling
getgrent_r(), which causes the controller to core dump.
parent
702fb424
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/slurmctld/groups.c
+24
-21
24 additions, 21 deletions
src/slurmctld/groups.c
with
24 additions
and
21 deletions
src/slurmctld/groups.c
+
24
−
21
View file @
2a674aee
...
...
@@ -115,13 +115,14 @@ extern uid_t *get_group_members(char *group_name)
while
(
1
)
{
res
=
getgrnam_r
(
group_name
,
&
grp
,
grp_buffer
,
buflen
,
&
grp_result
);
if
((
res
!=
0
)
&&
(
errno
==
ERANGE
))
{
buflen
*=
2
;
xrealloc
(
grp_buffer
,
buflen
);
continue
;
}
if
((
res
!=
0
)
||
(
grp_result
==
NULL
))
{
error
(
"Could not find configured group %s"
,
group_name
);
if
(
res
!=
0
)
{
if
(
errno
==
ERANGE
)
{
buflen
*=
2
;
xrealloc
(
grp_buffer
,
buflen
);
continue
;
}
error
(
"%s: Could not find configured group %s"
,
__func__
,
group_name
);
xfree
(
grp_buffer
);
return
NULL
;
}
...
...
@@ -135,13 +136,14 @@ extern uid_t *get_group_members(char *group_name)
setgrent_r
(
&
fp
);
while
(
1
)
{
res
=
getgrent_r
(
&
grp
,
grp_buffer
,
buflen
,
&
fp
);
if
(
(
res
!=
0
)
&&
(
errno
==
ERANGE
))
{
buflen
*=
2
;
xrealloc
(
grp_buffer
,
buflen
)
;
continue
;
}
if
(
res
!=
0
)
if
(
res
!=
0
)
{
if
(
errno
==
ERANGE
)
{
buflen
*=
2
;
xrealloc
(
grp_buffer
,
buflen
)
;
continue
;
}
break
;
}
grp_result
=
&
grp
;
#elif defined (__APPLE__) || defined (__CYGWIN__)
setgrent
();
...
...
@@ -152,13 +154,14 @@ extern uid_t *get_group_members(char *group_name)
setgrent
();
while
(
1
)
{
res
=
getgrent_r
(
&
grp
,
grp_buffer
,
buflen
,
&
grp_result
);
if
(
(
res
!=
0
)
&&
(
errno
==
ERANGE
))
{
buflen
*=
2
;
xrealloc
(
grp_buffer
,
buflen
)
;
continue
;
}
if
((
res
!=
0
)
||
(
grp_result
==
NULL
))
if
(
res
!=
0
)
{
if
(
errno
==
ERANGE
)
{
buflen
*=
2
;
xrealloc
(
grp_buffer
,
buflen
)
;
continue
;
}
break
;
}
#endif
if
(
grp_result
->
gr_gid
==
my_gid
)
{
if
(
strcmp
(
grp_result
->
gr_name
,
group_name
))
{
...
...
@@ -177,7 +180,7 @@ extern uid_t *get_group_members(char *group_name)
continue
;
if
(
j
+
1
>=
uid_cnt
)
{
uid_cnt
+=
100
;
xrealloc
(
group_uids
,
xrealloc
(
group_uids
,
(
sizeof
(
uid_t
)
*
uid_cnt
));
}
group_uids
[
j
++
]
=
my_uid
;
...
...
@@ -230,7 +233,7 @@ extern void clear_group_cache(void)
pthread_mutex_unlock
(
&
group_cache_mutex
);
}
/* Get a record from our group/uid cache.
/* Get a record from our group/uid cache.
* Return NULL if not found. */
static
uid_t
*
_get_group_cache
(
char
*
group_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