From: Theodore Ts'o Date: Tue, 2 Jun 2009 12:45:22 +0000 (-0400) Subject: filefrag: Fix error checking for the fiemap ioctl X-Git-Tag: v1.41.7~24 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=e78968f7a42fb1fa75c356dd323d957b307b887f;p=tools%2Fe2fsprogs.git filefrag: Fix error checking for the fiemap ioctl Thanks to Peng Tao for reporting this problem. Signed-off-by: "Theodore Ts'o" --- diff --git a/misc/filefrag.c b/misc/filefrag.c index 80ac05c..7095949 100644 --- a/misc/filefrag.c +++ b/misc/filefrag.c @@ -201,15 +201,14 @@ int filefrag_fiemap(int fd, int blk_shift, int *num_extents) fiemap->fm_flags = flags; fiemap->fm_extent_count = count; rc = ioctl(fd, FS_IOC_FIEMAP, (unsigned long) fiemap); - if (rc == -EBADR) { - if (fiemap_incompat_printed == 0) { + if (rc < 0) { + if (errno == EBADR && fiemap_incompat_printed == 0) { printf("FIEMAP failed with unsupported " "flags %x\n", fiemap->fm_flags); fiemap_incompat_printed = 1; } - } - if (rc) return rc; + } if (!verbose) { *num_extents = fiemap->fm_mapped_extents;