aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2020-01-16 15:35:29 -0500
committerTheodore Ts'o <tytso@mit.edu>2020-01-16 15:35:29 -0500
commitf6c5ad97daf7b266d66987476da33d6dfe341b36 (patch)
tree5e5d324aeb54d2235b4dac4f29156c2bf5562f06
parent00179a29867b72c47e074d8e0babe6622d074dba (diff)
downloade2fsprogs-f6c5ad97daf7b266d66987476da33d6dfe341b36.tar.gz
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 <tytso@mit.edu>
-rw-r--r--lib/ext2fs/ext2_err.et.in3
-rw-r--r--lib/ext2fs/imager.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/ext2fs/ext2_err.et.in b/lib/ext2fs/ext2_err.et.in
index b2ba71ad2..0c76fee64 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 7fd06f743..20bb99aea 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;