Signed-off-by: Lukas Czerner <lczerner@xxxxxxxxxx> --- misc/filefrag.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/misc/filefrag.c b/misc/filefrag.c index dc003931..c8444d76 100644 --- a/misc/filefrag.c +++ b/misc/filefrag.c @@ -306,8 +306,8 @@ static int filefrag_fibmap(int fd, int blk_shift, int *num_extents, fm_ext.fe_flags = FIEMAP_EXTENT_MERGED; } - if (sync_file) - fsync(fd); + if (sync_file && fsync(fd) != 0) + return -errno; for (i = 0, logical = 0, *num_extents = 0, count = last_block = 0; i < numblocks; -- 2.17.1