From: Ray Strode Date: Wed, 30 May 2007 00:46:07 +0000 (-0400) Subject: save errno before closing fds in error path and restore X-Git-Tag: 0.1.0~236 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa4848fbc2b44d8fe1c6e46b0db1b80f8d1e3411;p=thirdparty%2Fplymouth.git save errno before closing fds in error path and restore afterward. --- 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; }