LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File gfs2_edit_fix_error_message_blockalloc_when_outside_bitmap.patch of Package cluster (Project home:sschapiro:openstack:upstream)

commit 578af431fb74985e39ba8c3acf43459bd476947f
Author: Bob Peterson <rpeterso@redhat.com>
Date:   Thu Feb 3 10:35:37 2011 -0600

    gfs2_edit: Fix error message on blockalloc when outside bitmap
    
    If you specify gfs2_edit <block> blockalloc X and the block is
    part of the rgrp or bitmaps, it was not giving a proper error
    message.  This patch adds an error message.
    
    rhbz#674843

diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index bb59758..2a88a40 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -2568,6 +2568,11 @@ static void find_change_block_alloc(int *newval)
 				gfs2_rgrp_read(&sbd, rgd);
 				type = gfs2_get_bitmap(&sbd, ablock, rgd);
 				gfs2_rgrp_relse(rgd);
+				if (type < 0) {
+					printf("-1 (block invalid or part of "
+					       "an rgrp).\n");
+					exit(-1);
+				}
 				printf("%d (%s)\n", type, allocdesc[gfs1][type]);
 			} else {
 				gfs2_rgrp_free(&sbd.rglist);