From: Theodore Ts'o Date: Thu, 16 Jan 2020 20:35:29 +0000 (-0500) Subject: libext2fs: reserve the error code EXT2_ET_NO_GDESC X-Git-Tag: v1.45.6~40 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=f6c5ad97daf7b266d66987476da33d6dfe341b36;p=tools%2Fe2fsprogs.git libext2fs: reserve the error code EXT2_ET_NO_GDESC 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 --- diff --git a/lib/ext2fs/ext2_err.et.in b/lib/ext2fs/ext2_err.et.in index b2ba71a..0c76fee 100644 --- a/lib/ext2fs/ext2_err.et.in +++ b/lib/ext2fs/ext2_err.et.in @@ -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 diff --git a/lib/ext2fs/imager.c b/lib/ext2fs/imager.c index 7fd06f7..20bb99a 100644 --- a/lib/ext2fs/imager.c +++ b/lib/ext2fs/imager.c @@ -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;