#442 closed defect (fixed)
file never closed if ftruncate() fails in open()
Reported by: | strauman | Owned by: | Jennifer Averett |
---|---|---|---|
Priority: | lowest | Milestone: | 2 |
Component: | fs | Version: | 4.6 |
Severity: | normal | Keywords: | |
Cc: | bugs@… | Blocked By: | |
Blocking: |
Description
A bug reported by Sergej Organov on 2003/4/9; I (till) implemented a fix which should be reviewed. Sergej's original message - the bug still seems to be present in 4.6.0pre4:
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.
Release:
RTEMS-4.6.0pre4
Attachments (1)
Change History (2)
comment:1 Changed on 08/05/03 at 14:56:09 by Jennifer Averett
Status: | assigned → closed |
---|
State-Changed-From-To: open->closed
State-Changed-Why: patch applied to trunk and 4.6 branch.