[dm-devel] [PATCH 35/39] libmultipath: mark return value from dup() as unused

Hannes Reinecke hare at suse.de
Thu Jun 16 09:47:41 UTC 2016


We are redirecting stderr, and can safely ignore any
errors from dup() here. So mark the return value as
unused.
Found by coverity.

Signed-off-by: Hannes Reinecke <hare at suse.com>
---
 libmultipath/callout.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libmultipath/callout.c b/libmultipath/callout.c
index d671b0c..4d1b067 100644
--- a/libmultipath/callout.c
+++ b/libmultipath/callout.c
@@ -76,8 +76,10 @@ int execute_program(char *path, char *value, int len)
 		/* Ignore writes to stderr */
 		null_fd = open("/dev/null", O_WRONLY);
 		if (null_fd > 0) {
+			int err_fd __attribute__ ((unused));
+
 			close(STDERR_FILENO);
-			retval = dup(null_fd);
+			err_fd = dup(null_fd);
 			close(null_fd);
 		}
 
-- 
2.6.6




More information about the dm-devel mailing list