drivers/telnet: Return the partial sent bytes in telnet_write

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-09-28 22:41:04 +08:00 committed by Masayuki Ishikawa
parent d6bb08f6fd
commit a52fbe87eb

View File

@ -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;
}
/****************************************************************************