mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2025-01-03 15:41:54 +00:00
Birdloop pipe is set O_CLOEXEC.
If we decide to exec something, we shouldn't pass along our intenal fds.
This commit is contained in:
parent
0eb1548cc4
commit
169677deeb
@ -281,6 +281,8 @@ sysdep_dirs="`sed <$sysdesc '/^Link: /!d;s/^Link: \(.*\)$/\1/' | tr '\012' ' '`"
|
|||||||
AC_MSG_RESULT([$sysdep_dirs])
|
AC_MSG_RESULT([$sysdep_dirs])
|
||||||
AC_SUBST([sysdep_dirs])
|
AC_SUBST([sysdep_dirs])
|
||||||
|
|
||||||
|
AC_CHECK_FUNCS([pipe2])
|
||||||
|
|
||||||
if test "$with_iproutedir" = no ; then with_iproutedir= ; fi
|
if test "$with_iproutedir" = no ; then with_iproutedir= ; fi
|
||||||
|
|
||||||
if test -n "$given_iproutedir"
|
if test -n "$given_iproutedir"
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
* Can be freely distributed and used under the terms of the GNU GPL.
|
* Can be freely distributed and used under the terms of the GNU GPL.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define _GNU_SOURCE
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -195,15 +197,22 @@ birdloop_in_this_thread(struct birdloop *loop)
|
|||||||
void
|
void
|
||||||
pipe_new(struct pipe *p)
|
pipe_new(struct pipe *p)
|
||||||
{
|
{
|
||||||
|
int flags = O_NONBLOCK | O_CLOEXEC;
|
||||||
|
#if HAVE_PIPE2
|
||||||
|
int rv = pipe2(p->fd, flags);
|
||||||
|
if (rv < 0)
|
||||||
|
die("pipe2: %m");
|
||||||
|
#else
|
||||||
int rv = pipe(p->fd);
|
int rv = pipe(p->fd);
|
||||||
if (rv < 0)
|
if (rv < 0)
|
||||||
die("pipe: %m");
|
die("pipe: %m");
|
||||||
|
|
||||||
if (fcntl(p->fd[0], F_SETFL, O_NONBLOCK) < 0)
|
if (fcntl(p->fd[0], F_SETFL, flags) < 0)
|
||||||
die("fcntl(O_NONBLOCK): %m");
|
die("fcntl(O_NONBLOCK): %m");
|
||||||
|
|
||||||
if (fcntl(p->fd[1], F_SETFL, O_NONBLOCK) < 0)
|
if (fcntl(p->fd[1], F_SETFL, flags) < 0)
|
||||||
die("fcntl(O_NONBLOCK): %m");
|
die("fcntl(O_NONBLOCK): %m");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user