| 360 | } |
| 361 | |
| 362 | int AP_Filesystem_FATFS::close(int fileno) |
| 363 | { |
| 364 | FAT_FILE *stream; |
| 365 | FIL *fh; |
| 366 | int res; |
| 367 | |
| 368 | FS_CHECK_ALLOWED(-1); |
| 369 | WITH_SEMAPHORE(sem); |
| 370 | |
| 371 | errno = 0; |
| 372 | |
| 373 | // checks if fileno out of bounds |
| 374 | stream = fileno_to_stream(fileno); |
| 375 | if (stream == nullptr) { |
| 376 | return -1; |
| 377 | } |
| 378 | |
| 379 | // fileno_to_fatfs checks for fileno out of bounds |
| 380 | fh = fileno_to_fatfs(fileno); |
| 381 | if (fh == nullptr) { |
| 382 | return -1; |
| 383 | } |
| 384 | res = f_close(fh); |
| 385 | free_file_descriptor(fileno); |
| 386 | if (res != FR_OK) { |
| 387 | errno = fatfs_to_errno((FRESULT)res); |
| 388 | return -1; |
| 389 | } |
| 390 | return 0; |
| 391 | } |
| 392 | |
| 393 | int32_t AP_Filesystem_FATFS::read(int fd, void *buf, uint32_t count) |
| 394 | { |
nothing calls this directly
no test coverage detected