Skip to content

Commit 0169eb4

Browse files
J-Goldackerejohnstown
authored andcommitted
Fix SFTP_GetAttributes with fatfs for root
1 parent 0838634 commit 0169eb4

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/wolfsftp.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4922,9 +4922,6 @@ static int SFTP_GetAttributes(void* fs, const char* fileName,
49224922
(void) noFollow;
49234923
(void) heap;
49244924

4925-
ret = f_stat(fileName, &info);
4926-
if (ret != FR_OK)
4927-
return -1;
49284925
WMEMSET(atr, 0, sizeof(WS_SFTP_FILEATRB));
49294926
if (sz > 2 && fileName[sz - 2] == ':') {
49304927
atr->flags |= WOLFSSH_FILEATRB_PERM;
@@ -4933,12 +4930,14 @@ static int SFTP_GetAttributes(void* fs, const char* fileName,
49334930
}
49344931

49354932
/* handle case of "/" */
4933+
/* Calling f_stat for "/" returns FR_INVALID_NAME. So we simulate the result. */
49364934
if (sz < 3 && fileName[0] == WS_DELIM) {
49374935
atr->flags |= WOLFSSH_FILEATRB_PERM;
49384936
atr->per |= 0x4000;
49394937
return WS_SUCCESS;
49404938
}
49414939

4940+
ret = f_stat(fileName, &info);
49424941
if (ret != FR_OK) {
49434942
return WS_BAD_FILE_E;
49444943
}

0 commit comments

Comments
 (0)