mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/vfs_fat_(p)write_on_diskfull_v4.3' into 'release/v4.3'
vfs: bugfix vfs_fat_write/pwrite upon disk-full (v4.3) See merge request espressif/esp-idf!17650
This commit is contained in:
commit
9532e1ccc6
@ -375,6 +375,10 @@ static ssize_t vfs_fat_write(void* ctx, int fd, const void * data, size_t size)
|
||||
}
|
||||
unsigned written = 0;
|
||||
res = f_write(file, data, size, &written);
|
||||
if (((written == 0) && (size != 0)) && (res == 0)) {
|
||||
errno = ENOSPC;
|
||||
return -1;
|
||||
}
|
||||
if (res != FR_OK) {
|
||||
ESP_LOGD(TAG, "%s: fresult=%d", __func__, res);
|
||||
errno = fresult_to_errno(res);
|
||||
@ -459,6 +463,10 @@ static ssize_t vfs_fat_pwrite(void *ctx, int fd, const void *src, size_t size, o
|
||||
|
||||
unsigned wr = 0;
|
||||
f_res = f_write(file, src, size, &wr);
|
||||
if (((wr == 0) && (size != 0)) && (f_res == 0)) {
|
||||
errno = ENOSPC;
|
||||
return -1;
|
||||
}
|
||||
if (f_res == FR_OK) {
|
||||
ret = wr;
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user