Fix some static analysis issues

This commit is contained in:
Justine Tunney 2024-07-27 09:16:54 -07:00
parent fb54604b31
commit f147d3dde9
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
30 changed files with 375 additions and 266 deletions

View file

@ -75,7 +75,10 @@ FILE *popen(const char *cmdline, const char *mode) {
if ((f = fdopen(pipefds[dir], mode))) {
switch ((pid = fork())) {
case 0:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wanalyzer-fd-leak"
unassert(dup2(pipefds[!dir], !dir) == !dir);
#pragma GCC diagnostic pop
// we can't rely on cloexec because cocmd builtins don't execve
if (pipefds[0] != !dir)
unassert(!close(pipefds[0]));