]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfsprogs: fix return value of verify_set_primary_sb()
authorLi Zhong <zhong@linux.vnet.ibm.com>
Thu, 26 Sep 2013 06:48:12 +0000 (06:48 +0000)
committerRich Johnston <rjohnston@sgi.com>
Thu, 17 Oct 2013 19:45:39 +0000 (14:45 -0500)
If get_sb() fails because of EOF, it will return with retval 1, which will
then be interpreted as XR_BAD_MAGIC("bad magic number") in phase1() when
warning the user.

This patch fix it by using XR_EOF here, so it would be interpreted correctly.
Also change the associated comments about the return value.

Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
repair/sb.c

index d34d7a2a15d4e34b9b5e61c89192ebdcaf233a6f..2e35a4cb0d0bd6bb297bf9b9078f705c1957703d 100644 (file)
@@ -665,7 +665,7 @@ get_sb_geometry(fs_geometry_t *geo, xfs_sb_t *sbp)
  * primary and compare the geometries in the secondaries against
  * the geometry indicated by the primary.
  *
- * returns 1 if bad, 0 if ok
+ * returns 0 if ok, else error code (XR_EOF, XR_INSUFF_SEC_SB, etc).
  */
 int
 verify_set_primary_sb(xfs_sb_t         *rsb,
@@ -732,7 +732,7 @@ verify_set_primary_sb(xfs_sb_t              *rsb,
                        checked[agno] = 1;
 
                        if (get_sb(sb, off, size, agno) == XR_EOF)  {
-                               retval = 1;
+                               retval = XR_EOF;
                                goto out_free_list;
                        }