--- perlio.c.orig	2004-05-26 16:58:16.000000000 -0600
+++ perlio.c	2004-05-26 17:02:35.000000000 -0600
@@ -2824,7 +2824,15 @@
     /* XXX this could use PerlIO_canset_fileno() and
      * PerlIO_set_fileno() support from Configure
      */
-#  if defined(__GLIBC__)
+    #  if defined(__UCLIBC__)
+    /* uClibc must come before glibc because it defines __GLIBC__ as well. */
+    #  if defined(__MASK_READING)
+      f->__filedes = -1;
+    #  else
+      f->filedes = -1;
+    #  endif
+      return 1;
+    #  elif defined(__GLIBC__)    
     /* There may be a better way for GLIBC:
     	- libio.h defines a flag to not close() on cleanup
      */	
