From: Florian Forster Date: Sat, 13 Jul 2013 05:46:20 +0000 (+0200) Subject: write_graphite plugin: Don't call close() on invalid file descriptors. X-Git-Tag: collectd-5.3.1~1^2~1 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=04e34383fa26d39cca3d695169c869206d018f50;p=collectd.git write_graphite plugin: Don't call close() on invalid file descriptors. --- 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);