Skip to content
Snippets Groups Projects
Commit 1d7f2ece authored by Benoît Thébaudeau's avatar Benoît Thébaudeau Committed by Tom Rini
Browse files

fs/fat/fat_write: Merge calls to set_cluster()


set_contents() had uselessly split calls to set_cluster(). Merge these
calls, which removes some cases of set_cluster() being called with a
size of zero.

Signed-off-by: default avatarBenoît Thébaudeau <benoit@wsystem.com>
parent 8133f43d
No related branches found
No related tags found
No related merge requests found
...@@ -728,21 +728,10 @@ set_contents(fsdata *mydata, dir_entry *dentptr, __u8 *buffer, ...@@ -728,21 +728,10 @@ set_contents(fsdata *mydata, dir_entry *dentptr, __u8 *buffer,
endclust = newclust; endclust = newclust;
actsize += bytesperclust; actsize += bytesperclust;
} }
/* actsize >= file size */
actsize -= bytesperclust;
/* set remaining clusters */
if (set_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
debug("error: writing cluster\n");
return -1;
}
/* set remaining bytes */ /* set remaining bytes */
*gotsize += actsize;
filesize -= actsize;
buffer += actsize;
actsize = filesize; actsize = filesize;
if (set_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
if (set_cluster(mydata, endclust, buffer, (int)actsize) != 0) {
debug("error: writing cluster\n"); debug("error: writing cluster\n");
return -1; return -1;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment