bug-patch
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-patch] [PATCH] explicitly ignore close return value to placate stat


From: Jim Meyering
Subject: [bug-patch] [PATCH] explicitly ignore close return value to placate static analyzers
Date: Tue, 24 May 2011 13:32:04 +0200

coverity griped about this, but it's obviously not a problem
to ignore any failure of this particular close call (we're already
reporting a prior read failure), so I've marked it as explicitly ignored:

>From 450cb907cc988a5cb8a729f0f8e3ad96d2bfb628 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 24 May 2011 13:29:46 +0200
Subject: [PATCH] explicitly ignore close return value to placate static
 analyzers

* src/util.c: Include "ignore-value.h".
(ask): Use ignore_value to tell tools that yes, we really do
mean to ignore any close failure on this error path.
* bootstrap.conf (gnulib_modules): Add ignore-value.
---
 bootstrap.conf |    1 +
 src/util.c     |    3 ++-
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/bootstrap.conf b/bootstrap.conf
index 607ad1a..a460c57 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -34,6 +34,7 @@ gettime
 gitlog-to-changelog
 git-version-gen
 hash
+ignore-value
 lchmod
 lstat
 maintainer-makefile
diff --git a/src/util.c b/src/util.c
index a846007..85dd803 100644
--- a/src/util.c
+++ b/src/util.c
@@ -29,6 +29,7 @@
 #include <xalloc.h>

 #include <getdate.h>
+#include "ignore-value.h"

 #include <signal.h>
 #if !defined SIGCHLD && defined SIGCLD
@@ -1007,7 +1008,7 @@ ask (char const *format, ...)
        {
          perror ("tty read");
          fflush (stderr);
-         close (ttyfd);
+         ignore_value (close (ttyfd));
          ttyfd = -1;
          r = 0;
        }
--
1.7.5.2.585.gfbd48



reply via email to

[Prev in Thread] Current Thread [Next in Thread]