Whamcloud - gitweb
Fix compile error and warnings for old gcc versions
[tools/e2fsprogs.git] / debugfs / set_fields.c
index ca68862..e1e23a5 100644 (file)
@@ -75,8 +75,10 @@ static errcode_t parse_gd_csum(struct field_set_info *info, char *field, char *a
 static errcode_t parse_mmp_clear(struct field_set_info *info, char *field,
                                 char *arg);
 
+#if __GNUC_PREREQ (4, 6)
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wmissing-field-initializers"
+#endif
 
 static struct field_set_info super_fields[] = {
        { "inodes_count", &set_sb.s_inodes_count, NULL, 4, parse_uint },
@@ -289,7 +291,9 @@ static struct field_set_info mmp_fields[] = {
        { "checksum", &set_mmp.mmp_checksum, NULL, 4, parse_uint },
        { 0, 0, 0, 0 }
 };
+#if __GNUC_PREREQ (4, 6)
 #pragma GCC diagnostic pop
+#endif
 
 #ifdef UNITTEST
 
@@ -429,7 +433,7 @@ static struct field_set_info *find_field(struct field_set_info *fields,
 
 /*
  * Note: info->size == 6 is special; this means a base size 4 bytes,
- * and secondiory (high) size of 2 bytes.  This is needed for the
+ * and secondary (high) size of 2 bytes.  This is needed for the
  * special case of i_blocks_high and i_file_acl_high.
  */
 static errcode_t parse_uint(struct field_set_info *info, char *field,
@@ -495,7 +499,7 @@ static errcode_t parse_uint(struct field_set_info *info, char *field,
        }
        if (!field2)
                return 0;
-       n = num >> (size*8);
+       n = (size == 8) ? 0 : (num >> (size*8));
        u.ptr8 = (__u8 *) field2;
        if (info->size == 6)
                size = 2;
@@ -787,7 +791,7 @@ void do_set_inode(int argc, char *argv[])
 void do_set_block_group_descriptor(int argc, char *argv[])
 {
        const char *usage = "<bg number> <field> <value>\n"
-               "\t\"set_block_group_descriptor -l\" will list the names of "
+               "\t\"set_block_group -l\" will list the names of "
                "the fields in a block group descriptor\n\twhich can be set.";
        struct field_set_info   *table;
        struct field_set_info   *ss;
@@ -818,7 +822,7 @@ void do_set_block_group_descriptor(int argc, char *argv[])
                return;
        }
 
-       if (common_args_process(argc, argv, 4, 4, "set_block_group_descriptor",
+       if (common_args_process(argc, argv, 4, 4, "set_block_group",
                                usage, CHECK_FS_RW))
                return;