Summary: This avoids race conditions when two processes or more try to lock a file for writing. It could be that the process losing the race writes less than the winner, then we get rubbish at the end of the file. Calling `ftruncate(2)` inside the critical section makes sure the contents of the file are erased first. The harmful race was observed in xcodebuild sometimes, as it can call infer on the same file several times in parallel (!). Reviewed By: jberdine Differential Revision: D5209177 fbshipit-source-id: 744169cmaster
parent
47f1c6ffac
commit
a84df4673a
Loading…
Reference in new issue