From 34db0de2c12a1a802580fc308aa2f2b11a9d586f Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Sat, 9 May 2015 19:56:07 +0200 Subject: gfapi: fix compile warning in pub_glfs_h_access() While compiling libgfapi, the following warning is reported: Making all in src CC libgfapi_la-glfs-handleops.lo In file included from glfs-handleops.c:12:0: glfs-handleops.c: In function 'pub_glfs_h_access': glfs-internal.h:216:14: warning: 'old_THIS' may be used uninitialized in this function [-Wmaybe-uninitialized] THIS = old_THIS; \ ^ glfs-internal.h:202:36: note: 'old_THIS' was declared here #define DECLARE_OLD_THIS xlator_t *old_THIS = NULL ^ glfs-handleops.c:1159:2: note: in expansion of macro 'DECLARE_OLD_THIS' DECLARE_OLD_THIS; ^ CCLD libgfapi.la CCLD api.la The DECLARE_OLD_THIS macro should be done with the declarations of all the other variables used in this function. Moving the macro further up in the function prevents this warning. Backport of: > Change-Id: I2bedc1aa074893ae3e2c933abc5a167ab5b55f41 > BUG: 1210934 > Reviewed-on: http://review.gluster.org/10728 > Reported-by: Shyamsundar Ranganathan > Signed-off-by: Niels de Vos Change-Id: I2bedc1aa074893ae3e2c933abc5a167ab5b55f41 BUG: 1215787 Signed-off-by: Niels de Vos Reviewed-on: http://review.gluster.org/10730 Reviewed-by: Shyamsundar Ranganathan Tested-by: Gluster Build System --- api/src/glfs-handleops.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'api/src') diff --git a/api/src/glfs-handleops.c b/api/src/glfs-handleops.c index 8ff23ecff03..ae93439984a 100644 --- a/api/src/glfs-handleops.c +++ b/api/src/glfs-handleops.c @@ -1150,13 +1150,14 @@ pub_glfs_h_access (struct glfs *fs, struct glfs_object *object, int mask) inode_t *inode = NULL; loc_t loc = {0, }; + DECLARE_OLD_THIS; + /* validate in args */ if ((fs == NULL) || (object == NULL)) { errno = EINVAL; - goto out; + return ret; } - DECLARE_OLD_THIS; __GLFS_ENTRY_VALIDATE_FS (fs, invalid_fs); /* get the active volume */ -- cgit