filefrag: fix segfault on virtual fs
filefrag on a virtual fs like proc segfaults:
Floating point exception
because stat.f_blocks is 0, so the calculation of cylgroups is 0,
which leads to a divide by 0 when calculating expected extents.
Since it's only used for ext2 filesystems anyway, just move
the calculation of expected under "if (is_ext2)" to fix this.
Reported-by: Max Beikirch <maxnet@onlinehome.de>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
1 file changed