Main Content
Writing to read-only resource
File initially opened as read only is modified
Description
This defect occurs when you attempt to write to a file that you have opened earlier in read-only mode.
For instance, you open a file using fopen
with
the access mode argument r
. You write to that file
with a function in the fprintf
family.
Risk
Writing to a read-only file causes undefined behavior.
Fix
If you want to write to the file, open the file in a mode that is suitable for writing.
Examples
Result Information
Group: Resource management |
Language: C | C++ |
Default: On for handwritten code, off for generated code |
Command-Line Syntax: READ_ONLY_RESOURCE_WRITE |
Impact: High |
Version History
Introduced in R2015b
See Also
Topics
- Interpret Bug Finder Results in Polyspace Desktop User Interface
- Interpret Bug Finder Results in Polyspace Access Web Interface (Polyspace Access)
- Address Results in Polyspace User Interface Through Bug Fixes or Justifications
- Address Results in Polyspace Access Through Bug Fixes or Justifications (Polyspace Access)