Whamcloud - gitweb
libext2fs: reserve the error code EXT2_ET_NO_GDESC
authorTheodore Ts'o <tytso@mit.edu>
Thu, 16 Jan 2020 20:35:29 +0000 (15:35 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 16 Jan 2020 20:35:29 +0000 (15:35 -0500)
This is really only needed in the 1.46+ where the EXT2_FLAG_SUPER_ONLY
is honored by ext2fs_open to only read the superblock, so that
fs->group_desc can be NULL.  We define it in the maint branch so that
we can be sure the error tables are kept in sync (in the unlikely case
that a new error code needs to be assigned in the maint branch).

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/ext2_err.et.in
lib/ext2fs/imager.c

index b2ba71a..0c76fee 100644 (file)
@@ -545,4 +545,7 @@ ec  EXT2_ET_INODE_CORRUPTED,
 ec     EXT2_ET_EA_INODE_CORRUPTED,
        "Inode containing extended attribute value is corrupted"
 
+ec     EXT2_ET_NO_GDESC,
+       "Group descriptors not loaded"
+
        end
index 7fd06f7..20bb99a 100644 (file)
@@ -201,6 +201,9 @@ errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd,
        int             j;
 #endif
 
+       if (fs->group_desc == NULL)
+               return EXT2_ET_NO_GDESC;
+
        buf = malloc(fs->blocksize);
        if (!buf)
                return ENOMEM;