Skip to content

Commit

Permalink
nshlib: Introduce CONFIG_NSH_WGET_BUFF_SIZE
Browse files Browse the repository at this point in the history
Signed-off-by: Masayuki Ishikawa <[email protected]>
  • Loading branch information
masayuki2009 authored and patacongo committed May 19, 2020
1 parent 6a26547 commit bd47c46
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 8 additions & 0 deletions nshlib/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1121,6 +1121,14 @@ config NSH_NETINIT
---help---
This option enables/disables all network initialization in NSH.

if !NSH_DISABLE_WGET
config NSH_WGET_BUFF_SIZE
int "wget buffer size"
default 512
---help---
Buffer size for wget command
endif # NSH_DISABLE_WGET

endmenu # Networking Configuration"

menu "Telnet Configuration"
Expand Down
5 changes: 3 additions & 2 deletions nshlib/nsh_netcmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,7 @@ int cmd_wget(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)

/* Allocate an I/O buffer */

buffer = malloc(512);
buffer = malloc(CONFIG_NSH_WGET_BUFF_SIZE);
if (buffer == NULL)
{
fmt = g_fmtcmdoutofmemory;
Expand All @@ -1354,7 +1354,8 @@ int cmd_wget(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)

/* And perform the wget */

ret = wget(url, buffer, 512, wget_callback, (FAR void *)((intptr_t)fd));
ret = wget(url, buffer, CONFIG_NSH_WGET_BUFF_SIZE,
wget_callback, (FAR void *)((intptr_t)fd));
if (ret < 0)
{
nsh_error(vtbl, g_fmtcmdfailed, argv[0], "wget", NSH_ERRNO);
Expand Down

0 comments on commit bd47c46

Please sign in to comment.