From bc5877df666a8befe63ae4f56fcad849d9c5427a Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Fri, 5 Dec 2008 11:29:54 +0100 Subject: [PATCH] unixsock plugin: Make sure the initialization function is run only once. If called multiple times, the global `sock_fd' variable will be re-set, breaking the plugin. --- src/unixsock.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/unixsock.c b/src/unixsock.c index d80091b1..3dac88a4 100644 --- a/src/unixsock.c +++ b/src/unixsock.c @@ -382,8 +382,15 @@ static int us_config (const char *key, const char *val) static int us_init (void) { + static int have_init = 0; + int status; + /* Initialize only once. */ + if (have_init != 0) + return (0); + have_init = 1; + loop = 1; status = pthread_create (&listen_thread, NULL, us_server_thread, NULL); -- 2.11.0