[collectd] [PATCH] Get rid of a compiler warning with gcc 4.6.3

Dan Fandrich dan at coneharvesters.com
Mon Mar 18 23:17:16 CET 2013


...a futile warning that nevertheless kills the build thanks
to -Werror: "variable 'status' set but not used"
---
 src/utils_rrdcreate.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/utils_rrdcreate.c b/src/utils_rrdcreate.c
index 3b8f342..a34e0da 100644
--- a/src/utils_rrdcreate.c
+++ b/src/utils_rrdcreate.c
@@ -463,9 +463,8 @@ static int lock_file (char const *filename) /* {{{ */
     return (EEXIST);
   }
 
-  errno = 0;
   status = stat (filename, &sb);
-  if (errno != ENOENT)
+  if ((status == 0) || (errno != ENOENT))
   {
     pthread_mutex_unlock (&async_creation_lock);
     return (EEXIST);
-- 
1.7.10




More information about the collectd mailing list