Fixes are available
XL C/C++ for AIX Fix Pack 4 (July 2015 PTF) for 13.1
XL C/C++ Runtime for AIX Fix Pack 3 (July 2015 PTF) for 13.1
XL C/C++ for AIX Fix Pack 5 (November 2015 PTF) for 13.1
XL C/C++ Runtime for AIX Fix Pack 4 (November 2015 PTF) for 13.1
XL C/C++ for AIX Fix Pack 6 (February 2016 PTF) for 13.1
XL C/C++ Runtime for AIX Fix Pack 5 (February 2016 PTF) for 13.1
XL C/C++ for AIX Fix Pack 7 (May 2016 PTF) for 13.1
XL C/C++ for AIX Fix Pack 8 (August 2016 PTF) for 13.1
XL C/C++ for AIX Fix Pack 9 (June 2017 PTF) for 13.1
XL C/C++ for AIX Fix Pack 10 (February 2018 PTF) for 13.1
XL C/C++ for AIX Fix Pack 11 (November 2018 PTF) for 13.1
APAR status
Closed as program error.
Error description
An invalid FILE descriptor is kept by an ofstream object after encountering an ENOSPC 'No space left on device' error. The issue occurs when the ofstream close() function is called when the file system being written to is full. The system fclose() function is called, which in turn calls fflush() to write out any remaining data. The fflush() fails with an ENOSPC error due to the full filesystem, and fclose() returns -1. Even though -1 is returned, the fclose() function releases the FILE descriptor. Because -1 is returned from fclose(), the ofstream close() sets the ofstream failbit to 1, however is_open is still 1, and the FILE descriptor associated with the ofstream object is still treated as active. If the ofstream object is used again, it will be acting upon an inactive, invalid FILE descriptor, and undefined behaviour may be seen.
Local fix
Problem summary
PROBLEM DESCRIPTION: The C++ runtime incorrectly keeps the file descriptor alive after fclose() failed and the is_open flag remains true. This allows the second fclose() to close the file but the file descriptor has been freed by the first fclose() and reused by the system for another file. As a result, the second fclose() closes a different stream. USERS AFFECTED: Users who close a file stream twice because the first attempt failed with an error such as no space left on device.
Problem conclusion
The C++ runtime behavior does not comply with the C++ standard and has now been fixed.
Temporary fix
Comments
APAR Information
APAR number
IV74072
Reported component name
XL C/C++ FOR AI
Reported component ID
5725C7200
Reported release
D10
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2015-06-10
Closed date
2015-07-28
Last modified date
2015-07-28
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
Fix information
Fixed component name
XL C/C++ RUNTIM
Fixed component ID
5725C7201
Applicable component levels
RD10 PSY
UP
Document Information
Modified date:
28 July 2015