summaryrefslogtreecommitdiff
path: root/zebra/zserv.c
diff options
context:
space:
mode:
authorDenis Ovsienko <pilot@etcnet.org>2009-07-24 20:45:31 +0400
committerDenis Ovsienko <pilot@etcnet.org>2009-07-24 20:45:31 +0400
commit97be79f9d38b07214d5ad9b437e1a852c594a985 (patch)
treedbc8513b7f58c4f603ea1eed87efe9dbf4d7897e /zebra/zserv.c
parent5b40b1b57e1fad1caf579e032adf4e111128e486 (diff)
[zebra] do not touch socket before pidfile locking
Move zserv socket creation code into zebra_zserv_socket_init() and call it only after pidfile lock has been acquired exclusively. This keeps subsequent zebra daemons from deleting the working socket of an already running process (bug #403).
Diffstat (limited to 'zebra/zserv.c')
-rw-r--r--zebra/zserv.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/zebra/zserv.c b/zebra/zserv.c
index a566e6d4..cb5e411c 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -1704,13 +1704,6 @@ zebra_init (void)
/* Client list init. */
zebrad.client_list = list_new ();
- /* Make zebra server socket. */
-#ifdef HAVE_TCP_ZEBRA
- zebra_serv ();
-#else
- zebra_serv_un (ZEBRA_SERV_PATH);
-#endif /* HAVE_TCP_ZEBRA */
-
/* Install configuration write function. */
install_node (&table_node, config_write_table);
install_node (&forwarding_node, config_write_forwarding);
@@ -1737,3 +1730,14 @@ zebra_init (void)
/* Route-map */
zebra_route_map_init ();
}
+
+/* Make zebra server socket, wiping any existing one (see bug #403). */
+void
+zebra_zserv_socket_init (void)
+{
+#ifdef HAVE_TCP_ZEBRA
+ zebra_serv ();
+#else
+ zebra_serv_un (ZEBRA_SERV_PATH);
+#endif /* HAVE_TCP_ZEBRA */
+}