- retval = pipe(pipefds);
- if (retval < 0) {
- dbg("error getting pipes: %s", strerror(errno));
- exit(1);
- }
-
- retval = fcntl(pipefds[0], F_SETFL, O_NONBLOCK);
- if (retval < 0) {
- dbg("fcntl on read pipe: %s", strerror(errno));
- exit(1);
- }
-
- retval = fcntl(pipefds[1], F_SETFL, O_NONBLOCK);
- if (retval < 0) {
- dbg("fcntl on write pipe: %s", strerror(errno));
- exit(1);
- }
+ retval = pipe(pipefds);
+ if (retval < 0) {
+ dbg("error getting pipes: %s", strerror(errno));
+ exit(1);
+ }
+
+ retval = fcntl(pipefds[0], F_SETFL, O_NONBLOCK);
+ if (retval < 0) {
+ dbg("error fcntl on read pipe: %s", strerror(errno));
+ exit(1);
+ }
+ retval = fcntl(pipefds[0], F_SETFD, FD_CLOEXEC);
+ if (retval < 0) {
+ dbg("error fcntl on read pipe: %s", strerror(errno));
+ exit(1);
+ }
+
+ retval = fcntl(pipefds[1], F_SETFL, O_NONBLOCK);
+ if (retval < 0) {
+ dbg("error fcntl on write pipe: %s", strerror(errno));
+ exit(1);
+ }
+ retval = fcntl(pipefds[1], F_SETFD, FD_CLOEXEC);
+ if (retval < 0) {
+ dbg("error fcntl on write pipe: %s", strerror(errno));
+ exit(1);
+ }