diff --git a/ghc/lib/std/cbits/renameFile.c b/ghc/lib/std/cbits/renameFile.c
index 630e4d46226302203f584c027fd56882a75abc92..d62cbbf168f23211ffdf28509498b766b920d9af 100644
--- a/ghc/lib/std/cbits/renameFile.c
+++ b/ghc/lib/std/cbits/renameFile.c
@@ -1,7 +1,7 @@
 /* 
  * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
  *
- * $Id: renameFile.c,v 1.4 1999/03/01 09:27:49 sof Exp $
+ * $Id: renameFile.c,v 1.5 1999/09/30 12:35:50 sof Exp $
  *
  * renameFile Runtime Support
  */
@@ -21,7 +21,7 @@
 #include <fcntl.h>
 #endif
 
-#ifdef mingw32_TARGET_OS
+#if defined(mingw32_TARGET_OS) && !defined(O_NOCTTY)
 #define O_NOCTTY 0
 #endif