From 340e7c9f79a815c0f5aeb132c3510aa1c7bcaaeb Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Wed, 7 Dec 2022 13:50:03 +0100 Subject: [PATCH] samples: net: big_http_download: Fix POSIX compability The sample documentation mentions that the sample can be built directly on Linux, which was no longer the case. This commit fixes it. Signed-off-by: Robert Lubos --- .../sockets/big_http_download/src/big_http_download.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/samples/net/sockets/big_http_download/src/big_http_download.c b/samples/net/sockets/big_http_download/src/big_http_download.c index 88afa96ccf5..63cabaf4e15 100644 --- a/samples/net/sockets/big_http_download/src/big_http_download.c +++ b/samples/net/sockets/big_http_download/src/big_http_download.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "mbedtls/md.h" @@ -43,6 +44,12 @@ #define MAX_URL_LENGTH 256 #endif +#if defined(CONFIG_SAMPLE_BIG_HTTP_DL_NUM_ITER) +#define NUM_ITER CONFIG_SAMPLE_BIG_HTTP_DL_NUM_ITER +#else +#define NUM_ITER 0 +#endif + /* This URL is parsed in-place, so buffer must be non-const. */ static char download_url[MAX_URL_LENGTH] = #if defined(CONFIG_SAMPLE_BIG_HTTP_DL_URL) @@ -358,7 +365,7 @@ void main(void) unsigned int total_bytes = 0U; int resolve_attempts = 10; bool is_tls = false; - unsigned int num_iterations = CONFIG_SAMPLE_BIG_HTTP_DL_NUM_ITER; + unsigned int num_iterations = NUM_ITER; bool redirect = false; #if defined(CONFIG_NET_SOCKETS_SOCKOPT_TLS)