From f3a8953e6a72631dc29958e996388ffed2f5940a Mon Sep 17 00:00:00 2001 From: Csaba Henk Date: Thu, 16 Nov 2017 09:47:00 +0100 Subject: libglusterfs: fix the call_stack_set_group() function - call_stack_set_group() will take the ownership of passed buffer from caller; - to indicate the change, its signature is changed from including the buffer directly to take a pointer to it; - either the content of the buffer is copied to the groups_small embedded buffer of the call stack, or the buffer is set as groups_large member of the call stack; - the groups member of the call stack is set to, respectively, groups_small or groups_large, according to the memory management conventions of the call stack; - the buffer address is overwritten with junk to effectively prevent the caller from using it further on. Also move call_stack_set_group to stack.c from stack.h to prevent "defined but not used [-Wunused-function]" warnings (not using it anymore in call_stack_alloc_group() implementation, which saved us from this so far). protocol/server: refactor gid_resolve() In gid_resolve there are two cases: either the gid_cache_lookup() call returns a value or not. The result is caputured in the agl variable, and throughout the function, each particular stage of the implementation comes with an agl and a no-agl variant. In most cases this is explicitly indicated via an if (agl) { ... } else { ... } but some of this branching are expressed via goto constructs (obfuscating the fact we stated above, that is, each particular stage having an agl/no-agl variant). In the current refactor, we bring the agl conditional to the top, and present the agl/non-agl implementations sequentially. Also we take the opportunity to clean up and fix the agl case: - remove the spurious gl.gl_list = agl->gl_list; setting, as gl is not used in the agl caae - populate the group list of call stack from agl, fixing thus referred BUG. Also fixes BUG: 1513920 Change-Id: I61f4574ba21969f7661b9ff0c9dce202b874025d BUG: 1513928 Signed-off-by: Csaba Henk --- xlators/mount/fuse/src/fuse-helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xlators/mount/fuse') diff --git a/xlators/mount/fuse/src/fuse-helpers.c b/xlators/mount/fuse/src/fuse-helpers.c index 3fc6b16c41f..c59ff772cb8 100644 --- a/xlators/mount/fuse/src/fuse-helpers.c +++ b/xlators/mount/fuse/src/fuse-helpers.c @@ -181,7 +181,7 @@ frame_fill_groups (call_frame_t *frame) return; } - call_stack_set_groups (frame->root, ngroups, mygroups); + call_stack_set_groups (frame->root, ngroups, &mygroups); } else { ret = snprintf (filename, sizeof filename, "/proc/%d/status", frame->root->pid); -- cgit