author | Olivier Brunel
<jjk@jjacky.com> 2015-02-12 21:45:49 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2015-04-04 12:47:33 UTC |
parent | caac2e25558ccd00a01677fc22def411ad789397 |
src/libanopa/exec_oneshot.c | +17 | -0 |
diff --git a/src/libanopa/exec_oneshot.c b/src/libanopa/exec_oneshot.c index 06ce16f..f544a04 100644 --- a/src/libanopa/exec_oneshot.c +++ b/src/libanopa/exec_oneshot.c @@ -1,6 +1,7 @@ #include <sys/stat.h> #include <unistd.h> +#include <fcntl.h> #include <errno.h> #include <skalibs/allreadwrite.h> #include <skalibs/djbunix.h> @@ -92,6 +93,22 @@ _exec_oneshot (int si, aa_mode mode) goto err; } + else + { + int flags = fcntl (p_in[0], F_GETFL, 0); + if (flags < 0 || fcntl (p_in[0], F_SETFL, flags & ~O_NONBLOCK) < 0) + { + _errno = errno; + _err = "set up pipes"; + + fd_close (p_int[0]); + fd_close (p_int[1]); + fd_close (p_in[0]); + fd_close (p_in[1]); + + goto err; + } + } if (pipenb (p_out) < 0) { _errno = errno;