A client that keeps its configuration open makes Windows refuse the replacement for a moment (AUDIT-001-A12). The rename is retried a bounded number of times (under 1 s in all) on EPERM, EBUSY or EACCES; the content is checked again before every attempt, so an edit made meanwhile is never overwritten. Callers are synchronous, so the wait blocks. A change between the last check and the rename remains possible: there is no compare-and-swap for files. A new file is private (0600); an existing one keeps its mode.
Replaces a client or setup file only if it still holds
before.