diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2018-07-24 21:20:12 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2018-07-24 21:20:12 -0400 |
commit | 2aceb02c680b689e7cecb07573347418f2dd03be (patch) | |
tree | 720ad0b7f4d095378a2b115a5633a6bed16bf208 | |
parent | 0e0d6c2b46837291273f2e1ef7be62a206a997ef (diff) | |
download | bfs-2aceb02c680b689e7cecb07573347418f2dd03be.tar.xz |
util: Preserve errno in pipe_cloexec()
-rw-r--r-- | util.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -129,8 +129,10 @@ int pipe_cloexec(int pipefd[2]) { } if (fcntl(pipefd[0], F_SETFD, FD_CLOEXEC) == -1 || fcntl(pipefd[1], F_SETFD, FD_CLOEXEC) == -1) { + int error = errno; close(pipefd[1]); close(pipefd[0]); + errno = error; return -1; } |