From 1265873fa310aa42d42fdfad1483c5f66d304825 Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Tue, 20 May 2014 21:46:51 +0200 Subject: [PATCH] WMaker: removed use of dangerous RETRY macro in GetCommandForPid for Linux (Coverity #50267) As pointed by Coverity, the function GetCommandForPid did use a macro 'RETRY' for the 'close' of file descriptor, which is not correct because on success the function 'close' does not reset errno, and in case of failure the file descriptor is not more valid anyway. Signed-off-by: Christophe CURIS --- src/osdep_linux.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/osdep_linux.c b/src/osdep_linux.c index 6d246e5c..bb1ef2e6 100644 --- a/src/osdep_linux.c +++ b/src/osdep_linux.c @@ -15,10 +15,6 @@ #include "osdep.h" -#define RETRY( x ) do { \ - x; \ - } while (errno == EINTR); - /* * copy argc and argv for an existing process identified by `pid' * into suitable storage given in ***argv and *argc. @@ -54,10 +50,10 @@ Bool GetCommandForPid(int pid, char ***argv, int *argc) break; if (errno == EINTR) continue; - RETRY( close(fd) ) + close(fd); return False; } - RETRY( close(fd) ) + close(fd); /* count args */ for (i = 0; i < count; i++)