1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 04:20:27 +01:00

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 <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2014-05-20 21:46:51 +02:00
committed by Carlos R. Mafra
parent 1a64ca8275
commit 1265873fa3

View File

@@ -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++)