Whamcloud - gitweb
filefrag: fix segfault on virtual fs
authorEric Sandeen <sandeen@redhat.com>
Sat, 28 Jul 2012 21:52:13 +0000 (17:52 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 28 Jul 2012 21:53:30 +0000 (17:53 -0400)
commit339e457939bf1663ac2dbd52e47cd6e145726771
treeb621f268811097668575e4a32fbb8224c53235f1
parentb34056fea0e767a882256097c688bca9c377fe56
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>
misc/filefrag.c