check_valid_fd() does not touch its second parameter if the fd is not,
in fact, a valid fd. Initialize the "out" parameter to the opposite
of the value we are hoping for, so that both assertions will fail if
there is a problem.
Signed-off-by: Simon McVittie <smcv@collabora.com>
for (i = 0; i < n; i += 2)
{
- gboolean cloexec;
+ gboolean cloexec = TRUE;
if (pipe (&f->fds[i]) < 0)
g_error ("pipe: %s", g_strerror (errno));
for (i = 0; i < f->n_fds; i++)
{
- gboolean cloexec;
+ gboolean cloexec = TRUE;
g_assert_true (check_valid_fd (f->fds[i], &cloexec));
g_assert_false (cloexec);
for (i = 0; i < f->n_fds; i++)
{
- gboolean cloexec;
+ gboolean cloexec = FALSE;
g_assert_true (check_valid_fd (f->fds[i], &cloexec));
g_assert_true (cloexec);