Skip to content

Commit 7fd6a6b

Browse files
committed
add alternative path (compile time determined) if attempt to write >4GB should fail whole write or succeed but only up to 4GB (based on email from Tom)
1 parent 767cafa commit 7fd6a6b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

kernel/fatfs.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,8 +1249,14 @@ long rwblock(COUNT fd, VOID FAR * buffer, UCOUNT count, int mode)
12491249
{
12501250
if (mode == XFR_WRITE)
12511251
{
1252+
#if 1 /* we fail write call even if could partially succeed */
12521253
/* can't extend beyond 4G so return '0 byte written, DISK_FULL */
12531254
return DE_HNDLDSKFULL;
1255+
#else
1256+
/* truncate request to max size can write */
1257+
ULONG max_count = (ULONG)-1 - fnp->f_offset;
1258+
count = (max_count >= (UCOUNT)-1)?(UCOUNT)-1:(UCOUNT)max_count;
1259+
#endif
12541260
}
12551261
/* else XFR_READ should end automatically at EOF */
12561262
}

0 commit comments

Comments
 (0)