mirror of
https://github.com/espressif/openthread.git
synced 2026-08-17 16:09:51 +00:00
[hdlc-interface] ignore errno EINTR in socket read (#3310)
This commit changes `HdlcInterface::Read()` method to ignore `errno` `EINTR` (interrupt by a signal) during socket `read()`. It also uses `exit()` on error.
This commit is contained in:
committed by
Jonathan Hui
parent
3f3970ccaa
commit
3b158a61e9
@@ -141,20 +141,15 @@ void HdlcInterface::Read(void)
|
||||
|
||||
rval = read(mSockFd, buffer, sizeof(buffer));
|
||||
|
||||
if (rval < 0)
|
||||
{
|
||||
perror("HdlcInterface::Read()");
|
||||
|
||||
if (errno != EAGAIN)
|
||||
{
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
if (rval > 0)
|
||||
{
|
||||
Decode(buffer, static_cast<uint16_t>(rval));
|
||||
}
|
||||
else if ((rval < 0) && (errno != EAGAIN) && (errno != EINTR))
|
||||
{
|
||||
perror("HdlcInterface::Read()");
|
||||
exit(OT_EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
void HdlcInterface::Decode(const uint8_t *aBuffer, uint16_t aLength)
|
||||
|
||||
Reference in New Issue
Block a user