There is no need to generate a unique temporary name in x_unlink since
we don’t care whether the temporary file is clobbered on NFS. The
previous usage of tmp_string() was not quite correct since the returned
string is supposed to be passed to mkstemp, not used as is.
(cherry picked from commit
e7776305184c9338ee97334078153f298f6cfea7)
// If path is on an NFS share, unlink isn't atomic, so we rename to a temp
// file. We don't care if the temp file is trashed, so it's always safe to
// unlink it first.
- char* tmp_name = format("%s.rm.%s", path, tmp_string());
+ char* tmp_name = format("%s.ccache.rm.tmp", path);
int result = 0;
if (x_rename(path, tmp_name) == -1) {