We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7552b8c commit 7ea9b90Copy full SHA for 7ea9b90
system/coredump/coredump.c
@@ -240,7 +240,13 @@ static void coredump_restore(FAR char *savepath, size_t maxfile)
240
lseek(blkfd, 0, SEEK_SET);
241
while (offset < info.size)
242
{
243
- readsize = read(blkfd, swap, CONFIG_SYSTEM_COREDUMP_SWAPBUFFER_SIZE);
+ readsize = info.size - offset;
244
+ if (readsize > CONFIG_SYSTEM_COREDUMP_SWAPBUFFER_SIZE)
245
+ {
246
+ readsize = CONFIG_SYSTEM_COREDUMP_SWAPBUFFER_SIZE;
247
+ }
248
+
249
+ readsize = read(blkfd, swap, readsize);
250
if (readsize < 0)
251
252
printf("Read %s fail\n", CONFIG_SYSTEM_COREDUMP_DEVPATH);
0 commit comments