diff options
author | Theodore Ts'o <tytso@mit.edu> | 2011-10-16 19:29:40 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-10-16 19:29:40 -0400 |
commit | 515e555a0c36ae0294d71ba9ba45f7fa576cfd0f (patch) | |
tree | d99e49974a317686b34bfb883a272c08a18db825 /resize | |
parent | cacad7d641ef821ca7983d9dc0304baa9beaf3de (diff) | |
download | e2fsprogs-515e555a0c36ae0294d71ba9ba45f7fa576cfd0f.tar.gz |
resize2fs: don't fail when shrinking an empty file system
This commit fixes a failure when running the commands:
dd if=/dev/zero of=fs bs=1k count=100k; mke2fs fs; resize2fs -Mp fs
We should not try truncating the file system if there is only a single
block group in the file system.
Addresses-Sourceforge-Bug: #3404051
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'resize')
-rw-r--r-- | resize/resize2fs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/resize/resize2fs.c b/resize/resize2fs.c index 3c167664..a957850c 100644 --- a/resize/resize2fs.c +++ b/resize/resize2fs.c @@ -335,7 +335,7 @@ retry: fs->super->s_blocks_per_group; if ((fs->group_desc_count == 1) && rem && (rem < overhead)) return EXT2_ET_TOOSMALL; - if (rem && (rem < overhead+50)) { + if ((fs->group_desc_count > 1) && rem && (rem < overhead+50)) { ext2fs_blocks_count_set(fs->super, ext2fs_blocks_count(fs->super) - rem); goto retry; |