[ovs-dev] [PATCH 1/5] route-table-bsd: Stop caching pid

YAMAMOTO Takashi yamamoto at valinux.co.jp
Wed Dec 3 10:31:32 UTC 2014


The cache here doesn't work anymore as the recent
commit b772066ffd066d59d9ebce092f6665150723d2ad
("route-table: Remove Unregister.")
made this function called before daemonizing,
thus with a different pid.

Signed-off-by: YAMAMOTO Takashi <yamamoto at valinux.co.jp>
---
 lib/route-table-bsd.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lib/route-table-bsd.c b/lib/route-table-bsd.c
index b28ab33..6d5fe5c 100644
--- a/lib/route-table-bsd.c
+++ b/lib/route-table-bsd.c
@@ -32,8 +32,6 @@
 #include "ovs-router.h"
 #include "util.h"
 
-static int pid;
-
 bool
 ovs_router_lookup(ovs_be32 ip, char name[], ovs_be32 *gw)
 {
@@ -48,6 +46,7 @@ ovs_router_lookup(ovs_be32 ip, char name[], ovs_be32 *gw)
     struct sockaddr *sa;
     static int seq;
     int i, len, namelen, rtsock;
+    const pid_t pid = getpid();
 
     rtsock = socket(PF_ROUTE, SOCK_RAW, 0);
     if (rtsock < 0)
@@ -117,7 +116,6 @@ route_table_get_change_seq(void)
 void
 route_table_init(void)
 {
-    pid = getpid();
 }
 
 void
-- 
1.9.4




More information about the dev mailing list