projects
/
collectd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1862f17
)
unixsock plugin: Make sure the initialization function is run only once.
author
Florian Forster
<octo@noris.net>
Fri, 5 Dec 2008 10:29:54 +0000
(11:29 +0100)
committer
Florian Forster
<octo@noris.net>
Fri, 5 Dec 2008 10:29:54 +0000
(11:29 +0100)
If called multiple times, the global `sock_fd' variable will be re-set,
breaking the plugin.
src/unixsock.c
patch
|
blob
|
history
diff --git
a/src/unixsock.c
b/src/unixsock.c
index
d80091b
..
3dac88a
100644
(file)
--- 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);