> It needs to be in the locked directory

(For the record: that would break `rename` as the temporary directory can be on another filesystem.)