From 6f7e9227a4581d98171c2eb471690e21f92dfde3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Vavru=C5=A1a?= <marek.vavrusa@nic.cz> Date: Mon, 8 Dec 2014 14:02:19 +0100 Subject: [PATCH] main: log socket binding --- daemon/main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/daemon/main.c b/daemon/main.c index 3813c9d28..06e34da18 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -88,10 +88,18 @@ int main(int argc, char **argv) uv_signal_start(&sigint, signal_handler, SIGINT); /* Bind to sockets. */ + char addr_str[SOCKADDR_STRLEN] = {'\0'}; + sockaddr_tostr(&addr, addr_str, sizeof(addr_str)); uv_udp_t udp_sock; memset(&udp_sock, 0, sizeof(uv_udp_t)); uv_udp_init(loop, &udp_sock); - uv_udp_bind(&udp_sock, (struct sockaddr *)&addr, 0); + ret = uv_udp_bind(&udp_sock, (struct sockaddr *)&addr, 0); + if (ret == 0) { + fprintf(stdout, "[system] listening on '%s'\n", addr_str); + } else { + fprintf(stderr, "[system] failed to bind to '%s'\n", addr_str); + return EXIT_FAILURE; + } /* Start a worker. */ struct worker_ctx worker; -- GitLab