]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commit - lib/ext2fs/fileio.c
libext2fs: when truncating file, punch out blocks at end
authorDarrick J. Wong <djwong@us.ibm.com>
Wed, 15 Feb 2012 20:11:46 +0000 (15:11 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 17 Feb 2012 19:32:10 +0000 (14:32 -0500)
commit9e89dbbd462b389b6406eb9f02eb63ca997b0e8a
tree2928472ccd2a25552e4e50160ef762ebc4a61974
parent237b7b23fe69a83a9bb1d98d014d26f146ac26a3
libext2fs: when truncating file, punch out blocks at end

Currently, ext2fs_file_set_size2 punches out data blocks between the
end of the file and infinity when truncate_block <= old_truncate
(i.e. when you've made the file longer).  This is not a useful
behavior, particularly since it *fails* to punch out the data blocks
when the file is shortened (i.e. truncate_block < old_truncate).  This
seems to be the result of the test being backwards, so fix the code to
punch only when the file is getting shorter.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/fileio.c