diff mbox series

mongoose: fix info message

Message ID 20240212182100.79969-1-daniel@braunwarth.dev
State Accepted
Headers show
Series mongoose: fix info message | expand

Commit Message

Daniel Braunwarth Feb. 12, 2024, 6:21 p.m. UTC
This patch fixes the output of the IP address mongoose is listening on.

The info message has also been extended by the port mongoose is
listening on.

Signed-off-by: Daniel Braunwarth <daniel@braunwarth.dev>
---
 mongoose/mongoose_interface.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Stefano Babic Feb. 12, 2024, 9:11 p.m. UTC | #1
On 12.02.24 19:21, Daniel Braunwarth wrote:
> This patch fixes the output of the IP address mongoose is listening on.
>
> The info message has also been extended by the port mongoose is
> listening on.
>
> Signed-off-by: Daniel Braunwarth <daniel@braunwarth.dev>
> ---
>   mongoose/mongoose_interface.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/mongoose/mongoose_interface.c b/mongoose/mongoose_interface.c
> index 18f34d0..06fb2b0 100644
> --- a/mongoose/mongoose_interface.c
> +++ b/mongoose/mongoose_interface.c
> @@ -18,6 +18,7 @@
>   #include <stdlib.h>
>   #include <string.h>
>   #include <unistd.h>
> +#include <inttypes.h>
>   #include <stdbool.h>
>
>   #include <getopt.h>
> @@ -938,9 +939,9 @@ int start_mongoose(const char *cfgfname, int argc, char *argv[])
>   	start_thread(broadcast_message_thread, NULL);
>   	start_thread(broadcast_progress_thread, NULL);
>
> -	mg_snprintf(buf, sizeof(buf), "%I", 4, &nc->loc);
> -	INFO("Mongoose web server version %s with pid %d started on [%s] with web root [%s]",
> -		MG_VERSION, getpid(), buf, s_http_server_opts.root_dir);
> +	mg_snprintf(buf, sizeof(buf), "%I", 4, &nc->loc.ip);
> +	INFO("Mongoose web server v%s with PID %d listening on %s:%" PRIu16 " and serving %s",
> +		MG_VERSION, getpid(), buf, mg_ntohs(nc->loc.port), s_http_server_opts.root_dir);
>
>   	while (s_signo == 0)
>   		mg_mgr_poll(&mgr, 100);


Reviewed-by: Stefano Babic <stefano.babic@swupdate.org>
diff mbox series

Patch

diff --git a/mongoose/mongoose_interface.c b/mongoose/mongoose_interface.c
index 18f34d0..06fb2b0 100644
--- a/mongoose/mongoose_interface.c
+++ b/mongoose/mongoose_interface.c
@@ -18,6 +18,7 @@ 
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <inttypes.h>
 #include <stdbool.h>
 
 #include <getopt.h>
@@ -938,9 +939,9 @@  int start_mongoose(const char *cfgfname, int argc, char *argv[])
 	start_thread(broadcast_message_thread, NULL);
 	start_thread(broadcast_progress_thread, NULL);
 
-	mg_snprintf(buf, sizeof(buf), "%I", 4, &nc->loc);
-	INFO("Mongoose web server version %s with pid %d started on [%s] with web root [%s]",
-		MG_VERSION, getpid(), buf, s_http_server_opts.root_dir);
+	mg_snprintf(buf, sizeof(buf), "%I", 4, &nc->loc.ip);
+	INFO("Mongoose web server v%s with PID %d listening on %s:%" PRIu16 " and serving %s",
+		MG_VERSION, getpid(), buf, mg_ntohs(nc->loc.port), s_http_server_opts.root_dir);
 
 	while (s_signo == 0)
 		mg_mgr_poll(&mgr, 100);