diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 3cb1684e86408894a967ebb119704d4f85e441c8..d9e10319eb1d3679b4fed8292bbd475f2960d9d3 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,9 @@
+2002-12-23  Danny Smith  <dannysmith@users.sourceforge.net>
+
+	* config/io/basic_file_stdio.cc (__basic_file::_M_open_mode):
+	Don't use O_NONBLOCK if it is not defined.
+	(__basic_file::open): Don't use fcntl either.
+
 2002-12-20  Sylvain Pion   <Sylvain.Pion@mpi-sb.mpg.de>
 
 	* include/bits/stl_deque.h: Fix typo.
diff --git a/libstdc++-v3/config/io/basic_file_stdio.cc b/libstdc++-v3/config/io/basic_file_stdio.cc
index ff23d983ae848b56e9a7977ef7aeeb2edaeb71c6..e378b6668a72c441e1f405ecf86361805eaf8ef5 100644
--- a/libstdc++-v3/config/io/basic_file_stdio.cc
+++ b/libstdc++-v3/config/io/basic_file_stdio.cc
@@ -74,7 +74,11 @@ namespace std
     if (__testi && !__testo && !__testt && !__testa)
       {
 	strcpy(__c_mode, "r");
+#if defined (O_NONBLOCK)
 	__p_mode |=  O_RDONLY | O_NONBLOCK;
+#else
+	__p_mode |=  O_RDONLY;
+#endif
       }
     if (__testi && __testo && !__testt && !__testa)
       {
@@ -151,9 +155,11 @@ namespace std
 	  {
 	    _M_cfile_created = true;
 
+#if defined (F_SETFL) && defined (O_NONBLOCK)
 	    // Set input to nonblocking for fifos.
 	    if (__mode & ios_base::in)
 	      fcntl(this->fd(), F_SETFL, O_NONBLOCK);
+#endif
 
 	    __ret = this;
 	  }