If the compiler produced stderr, a temporary file leaks if depend mode
is enabled. Also, if the compiler does not produce stderr and depend
mode is enable, an unnecessary unlink is attempted.
Fix this by restructuring logic related to deletion of the temporary
file.
} else {
copy_file_to_cache(tmp_stderr, cached_stderr);
}
- } else {
+ } else if (conf->recache) {
+ // If recaching, we need to remove any previous .stderr.
+ x_unlink(cached_stderr);
+ }
+ if (st.st_size == 0 || conf->depend_mode) {
tmp_unlink(tmp_stderr);
- if (conf->recache) {
- // If recaching, we need to remove any previous .stderr.
- x_unlink(cached_stderr);
- }
}
copy_file_to_cache(output_obj, cached_obj);