From aa4848fbc2b44d8fe1c6e46b0db1b80f8d1e3411 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Tue, 29 May 2007 20:46:07 -0400 Subject: [PATCH] save errno before closing fds in error path and restore afterward. --- src/ply-utils.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ply-utils.c b/src/ply-utils.c index cdff0efa..0343bf3b 100644 --- a/src/ply-utils.c +++ b/src/ply-utils.c @@ -60,15 +60,19 @@ ply_open_unidirectional_pipe (int *sender_fd, if (fcntl (pipe_fds[0], F_SETFD, O_NONBLOCK | FD_CLOEXEC) < 0) { + ply_save_errno (); close (pipe_fds[0]); close (pipe_fds[1]); + ply_restore_errno (); return false; } if (fcntl (pipe_fds[1], F_SETFD, O_NONBLOCK | FD_CLOEXEC) < 0) { + ply_save_errno (); close (pipe_fds[0]); close (pipe_fds[1]); + ply_restore_errno (); return false; }