From: Florian Forster Date: Tue, 8 May 2007 21:06:44 +0000 (+0200) Subject: unixsock plugin: Remove the socket-file after closing the socket. X-Git-Tag: collectd-4.0.0~46^2~2 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=080df5f215fcc480a3ca1f4841491c1997632764;p=collectd.git unixsock plugin: Remove the socket-file after closing the socket. --- diff --git a/src/unixsock.c b/src/unixsock.c index ac7828fe..e73f04ac 100644 --- a/src/unixsock.c +++ b/src/unixsock.c @@ -150,9 +150,9 @@ static int cache_insert (const data_set_t *ds, const value_list_t *vl) value_cache_t *vc; int i; - DEBUG ("unixsock plugin: cache_insert: ds->ds_num = %i;" + DEBUG ("unixsock plugin: cache_insert: ds->type = %s; ds->ds_num = %i;" " vl->values_len = %i;", - ds->ds_num, vl->values_len); + ds->type, ds->ds_num, vl->values_len); assert (ds->ds_num == vl->values_len); vc = (value_cache_t *) malloc (sizeof (value_cache_t)); @@ -784,6 +784,15 @@ static void *us_server_thread (void *arg) close (sock_fd); sock_fd = -1; + status = unlink ((sock_file != NULL) ? sock_file : US_DEFAULT_PATH); + if (status != 0) + { + char errbuf[1024]; + NOTICE ("unixsock plugin: unlink (%s) failed: %s", + (sock_file != NULL) ? sock_file : US_DEFAULT_PATH, + sstrerror (errno, errbuf, sizeof (errbuf))); + } + return ((void *) 0); } /* void *us_server_thread */