--- /tmp/perlio.c	2005-09-09 12:36:21.327500360 +0300
+++ perl-5.8.4/perlio.c	2005-09-09 12:37:26.906530832 +0300
@@ -2824,7 +2824,11 @@
     /* 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. */
+    f->__filedes = -1;
+    return 1;
+#  elif defined(__GLIBC__)
     /* There may be a better way for GLIBC:
     	- libio.h defines a flag to not close() on cleanup
      */	

