From: simonmar Date: Fri, 5 Nov 1999 15:22:59 +0000 (+0000) Subject: [project @ 1999-11-05 15:22:59 by simonmar] X-Git-Tag: Approximately_9120_patches~5598 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=46a9ec151e8b78c44f93130eb36d7d325c72a76e;p=ghc-hetmet.git [project @ 1999-11-05 15:22:59 by simonmar] Clear the non-blocking flag on stderr before trying to print an error message. --- diff --git a/ghc/lib/std/cbits/writeError.c b/ghc/lib/std/cbits/writeError.c index e948233..3f58833 100644 --- a/ghc/lib/std/cbits/writeError.c +++ b/ghc/lib/std/cbits/writeError.c @@ -1,7 +1,7 @@ /* * (c) The GRASP/AQUA Project, Glasgow University, 1998 * - * $Id: writeError.c,v 1.2 1998/12/02 13:28:05 simonm Exp $ + * $Id: writeError.c,v 1.3 1999/11/05 15:22:59 simonmar Exp $ * * hPutStr Runtime Support */ @@ -19,6 +19,10 @@ implementation in one or two places.) #include "Rts.h" #include "stgio.h" +#ifdef HAVE_FCNTL_H +#include +#endif + void writeErrString__ (msg_hdr, msg, len) StgAddr msg_hdr; @@ -28,6 +32,13 @@ StgInt len; int count = 0; char* p = (char*)msg; char nl = '\n'; + long fd_flags; + +#if !defined(_WIN32) || defined(__CYGWIN__) || defined(__CYGWIN32__) + /* clear the non-blocking flag on this file descriptor */ + fd_flags = fcntl(2, F_GETFL); + fcntl(2, F_SETFL, fd_flags & ~O_NONBLOCK); +#endif /* Print error msg header */ if (msg_hdr) {