mirror of
https://github.com/espressif/openthread.git
synced 2026-07-30 07:37:46 +00:00
[posix] fix udp close (#5690)
This commit is contained in:
@@ -240,7 +240,10 @@ otError otPlatUdpClose(otUdpSocket *aUdpSocket)
|
||||
otError error = OT_ERROR_NONE;
|
||||
int fd;
|
||||
|
||||
VerifyOrExit(aUdpSocket->mHandle != nullptr, error = OT_ERROR_INVALID_ARGS);
|
||||
// Only call `close()` on platform UDP sockets.
|
||||
// Platform UDP sockets always have valid `mHandle` upon creation.
|
||||
VerifyOrExit(aUdpSocket->mHandle != nullptr);
|
||||
|
||||
fd = FdFromHandle(aUdpSocket->mHandle);
|
||||
VerifyOrExit(0 == close(fd), error = OT_ERROR_FAILED);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user