You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ma...@apache.org on 2022/09/30 03:54:36 UTC
[incubator-nuttx] 01/03: drivers/telnet: Return the partial sent bytes in telnet_write
This is an automated email from the ASF dual-hosted git repository.
masayuki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit a52fbe87eb0f80133f1ad73ad4a23efd8b558a0b
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Wed Sep 28 22:41:04 2022 +0800
drivers/telnet: Return the partial sent bytes in telnet_write
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
drivers/net/telnet.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/telnet.c b/drivers/net/telnet.c
index 5a283b2e91..613d33fde2 100644
--- a/drivers/net/telnet.c
+++ b/drivers/net/telnet.c
@@ -926,7 +926,7 @@ static ssize_t telnet_write(FAR struct file *filep, FAR const char *buffer,
{
nerr("ERROR: psock_send failed '%s': %zd\n",
priv->td_txbuffer, ret);
- return ret;
+ goto out;
}
/* Reset the index to the beginning of the TX buffer. */
@@ -944,7 +944,7 @@ static ssize_t telnet_write(FAR struct file *filep, FAR const char *buffer,
{
nerr("ERROR: psock_send failed '%s': %zd\n",
priv->td_txbuffer, ret);
- return ret;
+ goto out;
}
}
@@ -954,7 +954,8 @@ static ssize_t telnet_write(FAR struct file *filep, FAR const char *buffer,
* some logic if you report that you sent more than you were requested to.
*/
- return len;
+out:
+ return nsent ? nsent : ret;
}
/****************************************************************************