projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: getgrnam is not MT-Safe, use getgrnam_r
[lttng-tools.git]
/
src
/
lib
/
lttng-ctl
/
lttng-ctl.c
diff --git
a/src/lib/lttng-ctl/lttng-ctl.c
b/src/lib/lttng-ctl/lttng-ctl.c
index bbd9e85753e4d30ca708f437b3637143d1296836..bbff088e098107ebd64b171116f767a1f7126079 100644
(file)
--- a/
src/lib/lttng-ctl/lttng-ctl.c
+++ b/
src/lib/lttng-ctl/lttng-ctl.c
@@
-243,15
+243,13
@@
end:
LTTNG_HIDDEN
int lttng_check_tracing_group(void)
{
LTTNG_HIDDEN
int lttng_check_tracing_group(void)
{
- struct group *grp_tracing; /* no free(). See getgrnam(3) */
- gid_t *grp_list;
+ gid_t *grp_list, tracing_gid;
int grp_list_size, grp_id, i;
int ret = -1;
const char *grp_name = tracing_group;
/* Get GID of group 'tracing' */
int grp_list_size, grp_id, i;
int ret = -1;
const char *grp_name = tracing_group;
/* Get GID of group 'tracing' */
- grp_tracing = getgrnam(grp_name);
- if (!grp_tracing) {
+ if (utils_get_group_id(grp_name, false, &tracing_gid)) {
/* If grp_tracing is NULL, the group does not exist. */
goto end;
}
/* If grp_tracing is NULL, the group does not exist. */
goto end;
}
@@
-276,7
+274,7
@@
int lttng_check_tracing_group(void)
}
for (i = 0; i < grp_list_size; i++) {
}
for (i = 0; i < grp_list_size; i++) {
- if (grp_list[i] ==
grp_tracing->gr
_gid) {
+ if (grp_list[i] ==
tracing
_gid) {
ret = 1;
break;
}
ret = 1;
break;
}
This page took
0.025071 seconds
and
5
git commands to generate.