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 2d84aad90238904440f377eae0d945f59c0ecb20..561b0bcfba4e39a76eee320968985d8f09a18ef5 100644
(file)
--- a/
src/lib/lttng-ctl/lttng-ctl.c
+++ b/
src/lib/lttng-ctl/lttng-ctl.c
@@
-208,15
+208,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;
}
@@
-241,7
+239,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.024569 seconds
and
4
git commands to generate.