Fixed ntfsfallocate on a void file

The situation when there were no runlist when ntfsfallocate is applied
was not taken into account.
pull/2/head
Jean-Pierre André 2020-03-08 09:51:48 +01:00
parent eddd96f9e6
commit 4c8d97cbd2
1 changed files with 8 additions and 4 deletions

View File

@ -1,7 +1,7 @@
/**
* ntfsfallocate
*
* Copyright (c) 2013-2014 Jean-Pierre Andre
* Copyright (c) 2013-2020 Jean-Pierre Andre
*
* This utility will allocate clusters to a specified attribute belonging
* to a specified file or directory, to a specified length.
@ -775,10 +775,14 @@ static int ntfs_fallocate(ntfs_inode *ni, s64 alloc_offs, s64 alloc_len)
/* Get and save the initial allocations */
allocated_size = na->allocated_size;
data_size = ni->data_size;
err = ntfs_attr_map_whole_runlist(na);
if (na->rl)
err = ntfs_attr_map_whole_runlist(na);
if (!err) {
oldrl = ntfs_save_rl(na->rl);
if (oldrl) {
if (na->rl)
oldrl = ntfs_save_rl(na->rl);
else
oldrl = (runlist_element*)NULL;
if (!na->rl || oldrl) {
err = ntfs_full_allocation(na, ctx,
alloc_offs, alloc_len);
if (err) {