Fixed a bug when undeleting a sparse file

An old typo leading to a badly recovered file and sometimes to a segfault
This commit is contained in:
Jean-Pierre André 2011-09-26 15:03:38 +02:00
parent 08bf2b5bcb
commit 35fbb698ba

View File

@ -1784,7 +1784,7 @@ static int undelete_file(ntfs_volume *vol, long long inode)
if (rl[i].lcn == LCN_HOLE) {
ntfs_log_verbose("File has a sparse section.\n");
memset(buffer, 0, bufsize);
for (k = 0; k < rl[k].length * vol->cluster_size; k += bufsize) {
for (k = 0; k < rl[i].length * vol->cluster_size; k += bufsize) {
if (write_data(fd, buffer, bufsize) < bufsize) {
ntfs_log_perror("Write failed");
close(fd);