Commit 15ac2c4f authored by Cosimo Cecchi's avatar Cosimo Cecchi Committed by Stef Walter

main: don't call close() with a negative value

When run_foreground = TRUE, fork_and_print_environment() will return -1,
which is assigned to parent_wakeup_fd.
Since we don't want to call close(-1), only close(parent_wakeup_fd) when
run_foreground = FALSE.

https://bugzilla.gnome.org/show_bug.cgi?id=781785
parent 9db67ef6
......@@ -1133,10 +1133,11 @@ main (int argc, char *argv[])
/* Print the environment and tell the parent we're done */
print_environment ();
close (parent_wakeup_fd);
if (!run_foreground)
if (!run_foreground) {
close (parent_wakeup_fd);
redirect_fds_after_fork ();
}
g_unix_signal_add (SIGTERM, on_signal_term, loop);
g_unix_signal_add (SIGHUP, on_signal_term, loop);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment