aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFulup Ar Foll <fulup@iot.bzh>2017-07-13 23:42:37 +0200
committerGitHub <noreply@github.com>2017-07-13 23:42:37 +0200
commitb64500c1e9bc55e273bb57b8423b8c3d4f0ead83 (patch)
tree76ac8211f552bdd70b07849338039038a8e56dbe
parent78f5e26f3e977cba3711c2dcb15314d9821119fd (diff)
parent1cb82932afe865908badb3b4f989a8887609ef08 (diff)
Merge pull request #3 from tkummermehr/Fix_CDEV_Write
Fix crash of TX CDEV write, when there is many traffic
-rw-r--r--ucs2-afb/ucs_binding.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/ucs2-afb/ucs_binding.c b/ucs2-afb/ucs_binding.c
index 1819407..ba49e20 100644
--- a/ucs2-afb/ucs_binding.c
+++ b/ucs2-afb/ucs_binding.c
@@ -154,7 +154,6 @@ PUBLIC void UCSI_CB_SendMostMessage(void *pTag, const uint8_t *pData, uint32_t l
CdevData_t *cdevTx = &ucsContext->tx;
uint32_t total = 0;
-
if (NULL == pData || 0 == len) return;
if (O_RDONLY == cdevTx->fileFlags) return;
@@ -167,13 +166,11 @@ PUBLIC void UCSI_CB_SendMostMessage(void *pTag, const uint8_t *pData, uint32_t l
ssize_t written = write(cdevTx->fileHandle, &pData[total], (len - total));
if (0 >= written)
{
- cdevTx->fileHandle = -1;
- return;
+ /* Silently ignore write error (only occur in non-blocking mode) */
+ break;
}
total += (uint32_t) written;
}
-
- return;
}
/**