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:
committed by
Carlos R. Mafra
parent
1a64ca8275
commit
1265873fa3
@@ -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++)
|
||||
|
||||
Reference in New Issue
Block a user