]> git.ipfire.org Git - thirdparty/ccache.git/commit
Disable hard link mode when the output object file is /dev/null
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 22 Mar 2020 13:30:23 +0000 (14:30 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 22 Mar 2020 21:18:02 +0000 (22:18 +0100)
commit1905d633d3e3eabcc098eafeaff115e3b36223e0
tree53c86fc4d1c1188836b835ae2b25271a602d6dd1
parent7e3a6755f2c6ce17cd7d996cbefd5e37853cd916
Disable hard link mode when the output object file is /dev/null

When hard link mode is enabled, ccache ≥3.6 unlinks the output file
before writing to it as a workaround for a bug in Clang (#331). This
unfortunately means that /dev/null will be removed when building as root
(don’t do that, BTW) with hard link mode enabled and /dev/null as the
the output file. A similar problem exists if the dependency file is
/dev/null, regardless of hard link mode.

Fix this by not unlinking the output file if it’s /dev/null and by not
copying files to /dev/null at all. (There is no need to handle other
non-regular output files since /dev/null is the only allowed non-regular
output file.)

Fixes #564.

(cherry picked from commit 9a794689a8ba47e79c96d6c370976448b756973c)
src/ccache.cpp
src/result.cpp