[Cluster-devel] [PATCH 1/2] gfs2_convert: Fix misleading indentation warning

Andrew Price anprice at redhat.com
Thu Jun 30 10:55:35 UTC 2016


Caught by the new -Wmisleading-indentation warning in gcc 6:

    CC       gfs2_convert-gfs2_convert.o
  gfs2_convert.c: In function 'inode_renumber':
  gfs2_convert.c:1073:5: warning: this 'if' clause does not guard...
       if (block != rindex_addr && block != jindex_addr)
       ^~
  gfs2_convert.c:1075:6: note: ...this statement, but the latter is
  misleadingly indented as if it is guarded by the 'if'
        if (error) {
        ^~

Fortunately, this wasn't actually a bug, it just caused the value of
'error' to be checked when it couldn't possibly be non-zero as well as
the one time it could be.

Signed-off-by: Andrew Price <anprice at redhat.com>
---
 gfs2/convert/gfs2_convert.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index aac4853..9845049 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -1070,11 +1070,11 @@ static int inode_renumber(struct gfs2_sbd *sbp, uint64_t root_inode_addr, osi_li
 			bh = bread(sbp, block);
 			if (!gfs2_check_meta(bh, GFS_METATYPE_DI)) {/* if it is an dinode */
 				/* Skip the rindex and jindex inodes for now. */
-				if (block != rindex_addr && block != jindex_addr)
+				if (block != rindex_addr && block != jindex_addr) {
 					error = adjust_inode(sbp, bh);
-					if (error) {
+					if (error)
 						return error;
-					}
+				}
 			} else { /* It's metadata, but not an inode, so fix the bitmap. */
 				int blk, buf_offset;
 				int bitmap_byte; /* byte within the bitmap to fix */
-- 
2.7.4




More information about the Cluster-devel mailing list