Possible bug in 'open.c'

Sergei Organov osv at javad.ru
Wed Apr 9 15:03:21 UTC 2003


I think I've found minor bug in the open() routine (rtems-ss-20030128).

cpukit/libcsupport/src/open.c: 175:
    rc = ftruncate( iop - rtems_libio_iops, 0 );

if the call to ftruncate() somehow fails, the open() will return -1 but
will not close actual file that has been opened by

cpukit/libcsupport/src/open.c: 166:
  rc = (*iop->handlers->open_h)( iop, pathname, flags, mode );

As open() returns -1, the caller also will not try to call close() thus
leaving the file open.

ftruncate() can fail, e.g., if particular handler doesn't support the
file truncate feature.




More information about the users mailing list