fd = open(tmp_stderr, O_RDONLY | O_BINARY);
if (fd != -1) {
- if (str_eq(output_obj, "/dev/null") || errno == ENOENT) {
- /* we can use a quick method of getting the failed output */
- copy_fd(fd, 2);
- close(fd);
- tmp_unlink(tmp_stderr);
-
- if (output_dia) {
- int ret;
- x_unlink(output_dia);
- /* only make a hardlink if the cache file is uncompressed */
- ret = move_file(tmp_dia, output_dia, 0);
-
- if (ret == -1) {
- if (errno == ENOENT) {
- /* Someone removed the file just before we began copying? */
- cc_log("Diagnostic file %s just disappeared", output_dia);
- stats_update(STATS_MISSING);
- } else {
- cc_log("Failed to move %s to %s: %s",
- tmp_dia, output_dia, strerror(errno));
- stats_update(STATS_ERROR);
- failed();
- }
- x_unlink(tmp_dia);
+ /* we can output stderr immediately instead of re-running the
+ * compiler */
+ copy_fd(fd, 2);
+ close(fd);
+ tmp_unlink(tmp_stderr);
+
+ if (output_dia) {
+ int ret;
+ x_unlink(output_dia);
+ /* only make a hardlink if the cache file is uncompressed */
+ ret = move_file(tmp_dia, output_dia, 0);
+
+ if (ret == -1) {
+ if (errno == ENOENT) {
+ /* Someone removed the file just before we began copying? */
+ cc_log("Diagnostic file %s just disappeared", output_dia);
+ stats_update(STATS_MISSING);
} else {
- cc_log("Created %s from %s", output_dia, tmp_dia);
+ cc_log("Failed to move %s to %s: %s",
+ tmp_dia, output_dia, strerror(errno));
+ stats_update(STATS_ERROR);
+ failed();
}
+ x_unlink(tmp_dia);
+ } else {
+ cc_log("Created %s from %s", output_dia, tmp_dia);
}
-
- exit(status);
}
+
+ exit(status);
}
tmp_unlink(tmp_stderr);