...
If the programmer's intent is not to remove an existing destination file, the POSIX access()
function can be used to check for the existence of a file [Open Group 2004IEEE Std 1003.1:2013]. This compliant solution renames the source file only if the destination file does not exist:
...
Recommendation | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
FIO10-C | mediumMedium | probableProbable | mediumMedium | P8 | L2 |
Automated Detection
Tool | Version | Checker | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
PRQA QA-C |
| Warncall warncall -wc rename | Partially implemented |
...
Bibliography
[IEEE Std 1003.1:2013] | XSH, System Interfaces, access | |||
[MSDN] | rename | MSDN]rename() | [Open Group 2004] | access() |
...