mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-09 10:44:04 +02:00
gbacktrace: Fix fcntl command arguments not being checked
This commit is contained in:
@@ -340,7 +340,11 @@ stack_trace (const char * const *args)
|
|||||||
/* Save stderr for printing failure below */
|
/* Save stderr for printing failure below */
|
||||||
int old_err = dup (2);
|
int old_err = dup (2);
|
||||||
if (old_err != -1)
|
if (old_err != -1)
|
||||||
fcntl (old_err, F_SETFD, fcntl (old_err, F_GETFD) | FD_CLOEXEC);
|
{
|
||||||
|
int getfd = fcntl (old_err, F_GETFD);
|
||||||
|
if (getfd != -1)
|
||||||
|
(void) fcntl (old_err, F_SETFD, getfd | FD_CLOEXEC);
|
||||||
|
}
|
||||||
|
|
||||||
close (0); dup (in_fd[0]); /* set the stdin to the in pipe */
|
close (0); dup (in_fd[0]); /* set the stdin to the in pipe */
|
||||||
close (1); dup (out_fd[1]); /* set the stdout to the out pipe */
|
close (1); dup (out_fd[1]); /* set the stdout to the out pipe */
|
||||||
|
Reference in New Issue
Block a user