[Bug 2025] New: Questionable fcntl() implementation for F_DUPFD

bugzilla-daemon at rtems.org bugzilla-daemon at rtems.org
Mon Feb 20 11:42:39 UTC 2012


https://www.rtems.org/bugzilla/show_bug.cgi?id=2025

             Bug #: 2025
           Summary: Questionable fcntl() implementation for F_DUPFD
    Classification: Unclassified
           Product: RTEMS
           Version: HEAD
          Platform: All
        OS/Version: RTEMS
            Status: NEW
          Severity: normal
          Priority: P3
         Component: filesystem
        AssignedTo: chrisj at rtems.org
        ReportedBy: sebastian.huber at embedded-brains.de


What is the logic behind:

    case F_DUPFD:        /* dup */
      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 ) {
          ret = -1;
          break;
        }
      }

      diop->flags      = iop->flags;
      diop->pathinfo   = iop->pathinfo;
      ret = (int) (diop - rtems_libio_iops);
      break;

?

In case fd2 != 0 we wipe out the current state of the iop and replace it with
something else?

>From my point of view this is a resource leak.

-- 
Configure bugmail: https://www.rtems.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the bugs mailing list