#2025 closed defect (fixed)

Questionable fcntl() implementation for F_DUPFD

Reported by: Sebastian Huber Owned by: Chris Johns
Priority: normal Milestone: 4.11
Component: fs Version: 4.11
Severity: normal Keywords:
Cc: joel.sherrill@… Blocked By:
Blocking:

Description

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.

Change History (3)

comment:1 Changed on Feb 20, 2012 at 7:52:32 PM by Joel Sherrill

Cc: Joel Sherrill added

comment:2 Changed on Mar 13, 2012 at 11:51:20 AM by Sebastian Huber

Resolution: fixed
Status: newclosed

comment:3 Changed on Nov 24, 2014 at 6:58:28 PM by Gedare Bloom

Version: HEAD4.11

Replace Version=HEAD with Version=4.11 for the tickets with Milestone >= 4.11

Note: See TracTickets for help on using tickets.