diff --git a/ChangeLog b/ChangeLog index be32f2d7..a35fe476 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +xx/xx/2006 - 1.13.1-WIP + + - Fix bug in ntfs_attr_pwrite() when we sometimes lose current run in + the runlist. (Yura) + 27/02/2006 - 1.13.0 - Lots and lots and lots of fixes and enhancements. - Temporarily disable use of the legal ansi character checking in diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 085968f0..0abf4603 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1025,18 +1025,6 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) return count; } total = 0; - /* Find the runlist element containing the vcn. */ - rl = ntfs_attr_find_vcn(na, pos >> vol->cluster_size_bits); - if (!rl) { - /* - * If the vcn is not present it is an out of bounds write. - * However, we already extended the size of the attribute, - * so getting this here must be an error of some kind. - */ - if (errno == ENOENT) - errno = EIO; - goto err_out; - } /* Handle writes beyond initialized_size. */ if (pos + count > na->initialized_size) { if (ntfs_attr_map_whole_runlist(na)) @@ -1102,6 +1090,18 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) */ need_to.undo_initialized_size = 1; } + /* Find the runlist element containing the vcn. */ + rl = ntfs_attr_find_vcn(na, pos >> vol->cluster_size_bits); + if (!rl) { + /* + * If the vcn is not present it is an out of bounds write. + * However, we already extended the size of the attribute, + * so getting this here must be an error of some kind. + */ + if (errno == ENOENT) + errno = EIO; + goto err_out; + } /* * Scatter the data from the linear data buffer to the volume. Note, a * partial final vcn is taken care of by the @count capping of write