]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Merge branch 'maint'
authorJoel Rosdahl <joel@rosdahl.net>
Sat, 5 Jan 2013 17:39:51 +0000 (18:39 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 5 Jan 2013 17:39:51 +0000 (18:39 +0100)
* 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

1  2 
ccache.c
execute.c
util.c

diff --cc ccache.c
Simple merge
diff --cc execute.c
index 17278ee08303e417de46e2301476e8bc7e5bf0a4,761aa80b34baebe4ccc2f5ce55a8ca3511b8d7fe..7ecb1f23c1ddcba737b09cbabe2a7fc07e9750f7
+++ b/execute.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);
  
diff --cc util.c
index ecb0a07bb91f9b513b144dee9da7167c7cdfb8eb,3b472def20976e81f688593ebd66586eb6962d02..dd31324cb08dcf85f336f9779a2293a108a186ca
--- 1/util.c
--- 2/util.c
+++ b/util.c
@@@ -43,12 -43,16 +43,17 @@@ init_log(void
        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;