From c550e0e27199911820f77bc0b1ed9398b6d1a515 Mon Sep 17 00:00:00 2001 From: stolz Date: Tue, 21 Oct 2003 11:51:15 +0000 Subject: [PATCH] [project @ 2003-10-21 11:51:15 by stolz] Save one fcntl-call in setNonBlockingFd when Fd is already non-blocking. Please merge. --- ghc/rts/RtsUtils.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ghc/rts/RtsUtils.c b/ghc/rts/RtsUtils.c index 9637db0..6ff4f72 100644 --- a/ghc/rts/RtsUtils.c +++ b/ghc/rts/RtsUtils.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: RtsUtils.c,v 1.35 2003/08/22 22:24:16 sof Exp $ + * $Id: RtsUtils.c,v 1.36 2003/10/21 11:51:15 stolz Exp $ * * (c) The GHC Team, 1998-2002 * @@ -249,7 +249,9 @@ setNonBlockingFd(int fd) /* clear the non-blocking flag on this file descriptor */ fd_flags = fcntl(fd, F_GETFL); - fcntl(fd, F_SETFL, fd_flags | O_NONBLOCK); + if (!(fd_flags & O_NONBLOCK)) { + fcntl(fd, F_SETFL, fd_flags | O_NONBLOCK); + } } #else /* Stub defns -- async / non-blocking IO is not done -- 1.7.10.4