mirror of
https://github.com/wiiu-env/libfat.git
synced 2024-11-01 00:05:06 +01:00
correct use of uninitialised variable
This commit is contained in:
parent
571d57ee0a
commit
81110882db
@ -654,10 +654,9 @@ ssize_t _FAT_write_r (struct _reent *r, int fd, const char *ptr, size_t len) {
|
||||
_FAT_lock(&partition->lock);
|
||||
|
||||
// Only write up to the maximum file size, taking into account wrap-around of ints
|
||||
if (remain + file->filesize > FILE_MAX_SIZE || len + file->filesize < file->filesize) {
|
||||
if (len + file->filesize > FILE_MAX_SIZE || len + file->filesize < file->filesize) {
|
||||
len = FILE_MAX_SIZE - file->filesize;
|
||||
}
|
||||
remain = len;
|
||||
|
||||
// Short circuit cases where len is 0 (or less)
|
||||
if (len <= 0) {
|
||||
@ -665,6 +664,8 @@ ssize_t _FAT_write_r (struct _reent *r, int fd, const char *ptr, size_t len) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
remain = len;
|
||||
|
||||
// Get a new cluster for the start of the file if required
|
||||
if (file->startCluster == CLUSTER_FREE) {
|
||||
tempNextCluster = _FAT_fat_linkFreeCluster (partition, CLUSTER_FREE);
|
||||
|
Loading…
Reference in New Issue
Block a user