mirror of
https://github.com/espressif/openthread.git
synced 2026-08-21 09:59:52 +00:00
Spi-hdlc-adapter: Check for invalid fd errors (#1129)
This commit makes a change to `spi-hdlc-adapter` to check for any possible error case where either `sHdlcInputFd` or `sHdlcOutputFd` are invalid (e.g., `dup()` failures) before starting the main loop.
This commit is contained in:
committed by
Jonathan Hui
parent
afa5d13cfc
commit
490eabb0e1
@@ -1540,6 +1540,12 @@ int main(int argc, char *argv[])
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if ((sHdlcInputFd < 0) || (sHdlcOutputFd < 0))
|
||||
{
|
||||
sRet = EXIT_FAILURE;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
// Set up sHdlcInputFd for non-blocking I/O
|
||||
if (-1 == (i = fcntl(sHdlcInputFd, F_GETFL, 0)))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user