summaryrefslogtreecommitdiff
path: root/apps/system/zmodem/zm_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/system/zmodem/zm_utils.c')
-rw-r--r--apps/system/zmodem/zm_utils.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/apps/system/zmodem/zm_utils.c b/apps/system/zmodem/zm_utils.c
index 95eae7e8d..7717f6cbe 100644
--- a/apps/system/zmodem/zm_utils.c
+++ b/apps/system/zmodem/zm_utils.c
@@ -245,6 +245,7 @@ int zm_getc(int fd)
ssize_t zm_write(int fd, FAR const uint8_t *buffer, size_t buflen)
{
ssize_t nwritten;
+ size_t wrsize;
size_t total = 0;
/* Read reading as necessary until the requested buffer is filled or until
@@ -253,10 +254,20 @@ ssize_t zm_write(int fd, FAR const uint8_t *buffer, size_t buflen)
while (total < buflen)
{
- /* Get the next gulp of data from the file */
+#if CONFIG_SYSTEM_ZMODEM_WRITESIZE > 0
+ if (buflen > CONFIG_SYSTEM_ZMODEM_WRITESIZE)
+ {
+ wrsize = CONFIG_SYSTEM_ZMODEM_WRITESIZE;
+ }
+ else
+#endif
+ {
+ wrsize = buflen;
+ }
- nwritten = write(fd, buffer, buflen);
+ /* Get the next gulp of data from the file */
+ nwritten = write(fd, buffer, wrsize);
if (nwritten < 0)
{
int errorcode = errno;