Don't call close on invalid fds

If an fd is -1, don't call close() on it, since that leads to
EBDAF and complaints from valgrind.

https://bugzilla.gnome.org/show_bug.cgi?id=657593
This commit is contained in:
Matthias Clasen 2011-08-29 15:18:29 -04:00
parent fb94a0299b
commit dc38967fd3

View File

@ -1817,9 +1817,12 @@ g_test_trap_fork (guint64 usec_timeout,
}
}
}
close (stdout_pipe[0]);
close (stderr_pipe[0]);
close (stdtst_pipe[0]);
if (stdout_pipe[0] != -1)
close (stdout_pipe[0]);
if (stderr_pipe[0] != -1)
close (stderr_pipe[0]);
if (stdtst_pipe[0] != -1)
close (stdtst_pipe[0]);
if (need_wait)
{
int status = 0;