When sed is invoked with both -i (in-place edit) and --follow-symlinks, the function open_next_file() performs two separate, non-atomic filesystem operations on the same path:
- resolves symlink to its target and stores the resolved path for determining when output is written,
- opens the original symlink path (not the resolved one) to read the file.
This issue was fixed in version 4.10.