diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 5e2643ca7..0fd925de9 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+2002-12-19  Pierre Humblet <pierre.humblet@ieee.org>
+
+        * fhandler.cc (fhandler_base::open): Use "flags" rather than "mode"
+	in Win9X directory code.
+
 2002-12-19  Steve Osborn  <bub@io.com>
 
 	* fhandler.h (line_edit_status): Add a new element.
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index f73b8baf4..b9d6a1236 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -463,9 +463,9 @@ fhandler_base::open (path_conv *pc, int flags, mode_t mode)
     {
       if (!wincap.can_open_directories () && pc && pc->isdir ())
 	{
-	  if (mode & (O_CREAT | O_EXCL) == (O_CREAT | O_EXCL))
+	  if (flags & (O_CREAT | O_EXCL) == (O_CREAT | O_EXCL))
 	    set_errno (EEXIST);
-	  else if (mode & (O_WRONLY | O_RDWR))
+	  else if (flags & (O_WRONLY | O_RDWR))
 	    set_errno (EISDIR);
 	  else
 	    set_nohandle (true);