From 4f70acfac9c0b2d4fa1278675ba47a375b22ac92 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 16 Jan 2012 11:54:26 -0800 Subject: [PATCH] osd: abort on startup if we fail to bind to a port Signed-off-by: Sage Weil --- src/ceph_osd.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ceph_osd.cc b/src/ceph_osd.cc index c9a590443979d..99fba05cb6b21 100644 --- a/src/ceph_osd.cc +++ b/src/ceph_osd.cc @@ -275,14 +275,20 @@ int main(int argc, const char **argv) SimpleMessenger *messenger_hbin = new SimpleMessenger(g_ceph_context); SimpleMessenger *messenger_hbout = new SimpleMessenger(g_ceph_context); - client_messenger->bind(g_conf->public_addr, getpid()); + r = client_messenger->bind(g_conf->public_addr, getpid()); + if (r < 0) + exit(1); cluster_messenger->bind(g_conf->cluster_addr, getpid()); + if (r < 0) + exit(1); // hb should bind to same ip as cluster_addr (if specified) entity_addr_t hb_addr = g_conf->cluster_addr; if (!hb_addr.is_blank_ip()) hb_addr.set_port(0); messenger_hbout->bind(hb_addr, getpid()); + if (r < 0) + exit(1); global_print_banner(); -- 2.39.5