From 04e34383fa26d39cca3d695169c869206d018f50 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sat, 13 Jul 2013 07:46:20 +0200 Subject: [PATCH] write_graphite plugin: Don't call close() on invalid file descriptors. --- src/write_graphite.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/write_graphite.c b/src/write_graphite.c index aa87896f..bde5fb6e 100644 --- a/src/write_graphite.c +++ b/src/write_graphite.c @@ -247,8 +247,11 @@ static void wg_callback_free (void *data) wg_flush_nolock (/* timeout = */ 0, cb); - close(cb->sock_fd); - cb->sock_fd = -1; + if (cb->sock_fd >= 0) + { + close (cb->sock_fd); + cb->sock_fd = -1; + } sfree(cb->node); sfree(cb->service); -- 2.30.2