Ticket #1612: close.patch

File close.patch, 899 bytes (added by Vinu Rajashekhar, on Jul 12, 2010 at 3:24:08 PM)

Patch to close.c

  • cpukit/libcsupport/src/close.c

    diff --git a/cpukit/libcsupport/src/close.c b/cpukit/libcsupport/src/close.c
    index b242467..1c66cb4 100644
    a b  
    1515#include "config.h"
    1616#endif
    1717
     18#include <string.h>
     19
    1820#include <rtems/libio_.h>
    1921
    2022int close(
    2123  int  fd
    2224)
    2325{
    24   rtems_libio_t      *iop;
    25   rtems_status_code   rc;
     26  rtems_libio_t                    *iop;
     27  rtems_status_code                 rc;
     28  rtems_filesystem_location_info_t  loc;
    2629
    2730  rtems_libio_check_fd(fd);
    2831  iop = rtems_libio_iop(fd);
    int close( 
    3134  rc = RTEMS_SUCCESSFUL;
    3235  rc = (*iop->handlers->close_h)( iop );
    3336
     37  memset( &loc, 0, sizeof (loc) );
    3438  /* If not a socket, then freenode */
    35   if ( *((int *) &iop->pathinfo) )
     39  if ( memcmp( &iop->pathinfo, &loc, sizeof(loc) ) )
    3640    rtems_filesystem_freenode( &iop->pathinfo );
    3741  rtems_libio_free( iop );
    3842