Index: c/src/exec/libcsupport/src/fcntl.c
===================================================================
--- c/src/exec/libcsupport/src/fcntl.c	(revision 7a3878b26f5a94c3b88e715ccf84d097e925fe87)
+++ c/src/exec/libcsupport/src/fcntl.c	(revision 5822f437a1b826a30899036aa981c063ab274446)
@@ -28,4 +28,6 @@
   va_list        ap;
   rtems_libio_t *iop;
+  rtems_libio_t *diop;
+  int            fd2;
   
   va_start( ap, cmd );
@@ -51,16 +53,20 @@
   switch ( cmd ) {
     case F_DUPFD:        /* dup */
-      /*
-       *  This is how it appears that this case should work:
-       *
-       *     filedes2 = va_arg( ap, int )
-       *     if filedes2 is 0
-       *       duplicate fd into a new descriptor
-       *     else
-       *       duplicate fd into specified descriptor after error checking it
-       *
-       *  See dup2() in case we can eliminate stuff in there.
-       */
-      return -1;
+      fd2 = va_arg( ap, int );
+      if ( fd2 )
+        diop = rtems_libio_iop( fd2 );
+      else {
+        /* allocate a file control block */
+        diop = rtems_libio_allocate();
+        if ( diop == 0 )
+          return -1;
+      }
+
+      diop->handlers   = iop->handlers;
+      diop->file_info  = iop->file_info;
+      diop->flags      = iop->flags;
+      diop->pathinfo   = iop->pathinfo;
+      
+      return 0;
 
     case F_GETFD:        /* get f_flags */
Index: c/src/lib/libc/fcntl.c
===================================================================
--- c/src/lib/libc/fcntl.c	(revision 7a3878b26f5a94c3b88e715ccf84d097e925fe87)
+++ c/src/lib/libc/fcntl.c	(revision 5822f437a1b826a30899036aa981c063ab274446)
@@ -28,4 +28,6 @@
   va_list        ap;
   rtems_libio_t *iop;
+  rtems_libio_t *diop;
+  int            fd2;
   
   va_start( ap, cmd );
@@ -51,16 +53,20 @@
   switch ( cmd ) {
     case F_DUPFD:        /* dup */
-      /*
-       *  This is how it appears that this case should work:
-       *
-       *     filedes2 = va_arg( ap, int )
-       *     if filedes2 is 0
-       *       duplicate fd into a new descriptor
-       *     else
-       *       duplicate fd into specified descriptor after error checking it
-       *
-       *  See dup2() in case we can eliminate stuff in there.
-       */
-      return -1;
+      fd2 = va_arg( ap, int );
+      if ( fd2 )
+        diop = rtems_libio_iop( fd2 );
+      else {
+        /* allocate a file control block */
+        diop = rtems_libio_allocate();
+        if ( diop == 0 )
+          return -1;
+      }
+
+      diop->handlers   = iop->handlers;
+      diop->file_info  = iop->file_info;
+      diop->flags      = iop->flags;
+      diop->pathinfo   = iop->pathinfo;
+      
+      return 0;
 
     case F_GETFD:        /* get f_flags */
Index: cpukit/libcsupport/src/fcntl.c
===================================================================
--- cpukit/libcsupport/src/fcntl.c	(revision 7a3878b26f5a94c3b88e715ccf84d097e925fe87)
+++ cpukit/libcsupport/src/fcntl.c	(revision 5822f437a1b826a30899036aa981c063ab274446)
@@ -28,4 +28,6 @@
   va_list        ap;
   rtems_libio_t *iop;
+  rtems_libio_t *diop;
+  int            fd2;
   
   va_start( ap, cmd );
@@ -51,16 +53,20 @@
   switch ( cmd ) {
     case F_DUPFD:        /* dup */
-      /*
-       *  This is how it appears that this case should work:
-       *
-       *     filedes2 = va_arg( ap, int )
-       *     if filedes2 is 0
-       *       duplicate fd into a new descriptor
-       *     else
-       *       duplicate fd into specified descriptor after error checking it
-       *
-       *  See dup2() in case we can eliminate stuff in there.
-       */
-      return -1;
+      fd2 = va_arg( ap, int );
+      if ( fd2 )
+        diop = rtems_libio_iop( fd2 );
+      else {
+        /* allocate a file control block */
+        diop = rtems_libio_allocate();
+        if ( diop == 0 )
+          return -1;
+      }
+
+      diop->handlers   = iop->handlers;
+      diop->file_info  = iop->file_info;
+      diop->flags      = iop->flags;
+      diop->pathinfo   = iop->pathinfo;
+      
+      return 0;
 
     case F_GETFD:        /* get f_flags */
