File And Disk Problems (cont.) Solution 2: write to a temporary file, and only after the write, succeeded, rename() the temporary file over the new file - the rename() system call is defined to be atomic, and either succeeded or fail altogether. When multiple copies of a process try to write to the same file, its contents could become corrupt. Solution: use file locking. When writing to an NFS-mounted partition, write operations are often being cached on the NFS client machine. In such a case, the final close() call will flush the buffers, and might return an error due to write failures.