]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: abort on startup if we fail to bind to a port
authorSage Weil <sage@newdream.net>
Mon, 16 Jan 2012 19:54:26 +0000 (11:54 -0800)
committerSage Weil <sage@newdream.net>
Tue, 17 Jan 2012 17:36:31 +0000 (09:36 -0800)
Signed-off-by: Sage Weil <sage@newdream.net>
src/ceph_osd.cc

index c9a590443979da68d481e441e07e0bdb1eb89590..99fba05cb6b21518d14e3218d77365a6e644c007 100644 (file)
@@ -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();