Fix SFTP_GetAttributes with fatfs for root

pull/980/head
Jan Goldacker 2026-05-12 07:56:17 +02:00 committed by John Safranek
parent 0838634aab
commit 0169eb4544
1 changed files with 2 additions and 3 deletions

View File

@ -4922,9 +4922,6 @@ static int SFTP_GetAttributes(void* fs, const char* fileName,
(void) noFollow;
(void) heap;
ret = f_stat(fileName, &info);
if (ret != FR_OK)
return -1;
WMEMSET(atr, 0, sizeof(WS_SFTP_FILEATRB));
if (sz > 2 && fileName[sz - 2] == ':') {
atr->flags |= WOLFSSH_FILEATRB_PERM;
@ -4933,12 +4930,14 @@ static int SFTP_GetAttributes(void* fs, const char* fileName,
}
/* handle case of "/" */
/* Calling f_stat for "/" returns FR_INVALID_NAME. So we simulate the result. */
if (sz < 3 && fileName[0] == WS_DELIM) {
atr->flags |= WOLFSSH_FILEATRB_PERM;
atr->per |= 0x4000;
return WS_SUCCESS;
}
ret = f_stat(fileName, &info);
if (ret != FR_OK) {
return WS_BAD_FILE_E;
}