diff options
Diffstat (limited to 'ghc/lib/std/cbits/freeFile.c')
-rw-r--r-- | ghc/lib/std/cbits/freeFile.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/ghc/lib/std/cbits/freeFile.c b/ghc/lib/std/cbits/freeFile.c index 8f414ba4a4..b54e4802a1 100644 --- a/ghc/lib/std/cbits/freeFile.c +++ b/ghc/lib/std/cbits/freeFile.c @@ -1,7 +1,7 @@ /* * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 * - * $Id: freeFile.c,v 1.3 1998/12/02 13:27:34 simonm Exp $ + * $Id: freeFile.c,v 1.4 1999/05/05 10:33:15 sof Exp $ * * Giving up files */ @@ -10,6 +10,11 @@ #include "stgio.h" #include "fileObject.h" +#ifdef HAVE_WINSOCK_H +#include <winsock.h> +#endif + + /* sigh, the FILEs attached to the standard descriptors are handled differently. We don't want them freed via the ForeignObj finaliser, as we probably want to use these @@ -63,7 +68,14 @@ StgForeignPtr ptr; flushFile(ptr); } + if ( fo->flags & FILEOBJ_WINSOCK ) + /* Sigh - the cleanup call at the end will do this for us */ + return; +#ifdef HAVE_WINSOCK_H + rc = ( fo->flags & FILEOBJ_WINSOCK ? closesocket(fo->fd) : close(fo->fd) ); +#else rc = close(fo->fd); +#endif /* Error or no error, we don't care.. */ return; |