From: Sebastian Harl Date: Tue, 22 Oct 2013 07:08:37 +0000 (+0200) Subject: daemon: Exit if adding a listener fails. X-Git-Tag: sysdb-0.1.0~336^2~42 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3d006d61fc0d79a4e3d93caf7b42f85e49c3c2ef;p=sysdb.git daemon: Exit if adding a listener fails. --- diff --git a/src/daemon/sysdbd.c b/src/daemon/sysdbd.c index 6e75c03..072807d 100644 --- a/src/daemon/sysdbd.c +++ b/src/daemon/sysdbd.c @@ -273,10 +273,16 @@ main(int argc, char **argv) sdb_fe_socket_t *sock = sdb_fe_sock_create(); for (i = 0; i < listen_addresses_num; ++i) - sdb_fe_sock_add_listener(sock, listen_addresses[i]); - sdb_fe_sock_listen_and_serve(sock, &frontend_main_loop); + if (sdb_fe_sock_add_listener(sock, listen_addresses[i])) + break; + + /* break on error */ + if (i >= listen_addresses_num) + sdb_fe_sock_listen_and_serve(sock, &frontend_main_loop); + plugin_main_loop.do_loop = 0; pthread_join(backend_thread, NULL); + sdb_fe_sock_destroy(sock); } sdb_log(SDB_LOG_INFO, "Shutting down SysDB daemon "SDB_VERSION_STRING