mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
fix(ftp): List empty directory (#23638)
This commit is contained in:
parent
d5103d71b9
commit
79bb30ce3d
@ -399,17 +399,11 @@ MavlinkFTP::_workList(PayloadHeader *payload)
|
||||
payload->data[offset++] = kDirentSkip;
|
||||
*((char *)&payload->data[offset]) = '\0';
|
||||
offset++;
|
||||
payload->size = offset;
|
||||
closedir(dp);
|
||||
errorCode = kErrFailErrno;
|
||||
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
// FIXME: does this ever happen? I would assume readdir always sets errno.
|
||||
// no more entries?
|
||||
if (payload->offset != 0 && offset == 0) {
|
||||
} else if (offset == 0) {
|
||||
// User is requesting subsequent dir entries but there were none. This means the user asked
|
||||
// to seek past EOF.
|
||||
// to seek past EOF. This can happen with `payload->offset == 0` if the directory is empty.
|
||||
errorCode = kErrEOF;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user