* maint:
Handle disappearing temporary stdout file gracefully
Improve error reporting when failing to create stdout/stderr file in execute()
Don't leak log file descriptor to executed commands
Improve x_unlink's temporary filename
Conflicts:
ccache.c
execute.c
util.c
#include "ccache.h"
+ /* Let's hope no compiler uses these exit statuses. */
+ #define FAILED_TO_CREATE_STDOUT 212
+ #define FAILED_TO_CREATE_STDERR 213
+
+extern struct conf *conf;
+
static char *
find_executable_in_path(const char *name, const char *exclude_name, char *path);
if (logfile) {
return true;
}
- if (!cache_logfile) {
+ assert(conf);
+ if (str_eq(conf->log_file, "")) {
return false;
}
- logfile = fopen(cache_logfile, "a");
+ logfile = fopen(conf->log_file, "a");
if (logfile) {
+ int fd = fileno(logfile);
+ int flags = fcntl(fd, F_GETFD, 0);
+ if (flags >= 0) {
+ fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
+ }
return true;
} else {
return false;