...
Some platforms may forbid a file simultaneously being opened multiple times, but other platforms may allow it. Therefore, portable code cannot depend on what will happen if this rule is violated. Even on implementations which do not outright fail to open an already-opened file, a TOCTOU race condition exists where the second open could operate on a different file from the first due to the file being moved or deleted. See FIO45-C. Avoid TOCTOU race conditions while accessing files for more details on TOCTOU race conditions.
Noncompliant Code Example
...