]> git.ipfire.org Git - thirdparty/git.git/blobdiff - write-or-die.c
ci(linux32): add a note about Actions that must not be updated
[thirdparty/git.git] / write-or-die.c
index 42a2dc73cd3f18638445780e7fa9aa9b67ba871c..39421528653e29cbd724153edf94d2613ea1d6b4 100644 (file)
 void maybe_flush_or_die(FILE *f, const char *desc)
 {
        static int skip_stdout_flush = -1;
-       struct stat st;
-       char *cp;
 
        if (f == stdout) {
                if (skip_stdout_flush < 0) {
-                       /* NEEDSWORK: make this a normal Boolean */
-                       cp = getenv("GIT_FLUSH");
-                       if (cp)
-                               skip_stdout_flush = (atoi(cp) == 0);
-                       else if ((fstat(fileno(stdout), &st) == 0) &&
-                                S_ISREG(st.st_mode))
-                               skip_stdout_flush = 1;
-                       else
-                               skip_stdout_flush = 0;
+                       skip_stdout_flush = git_env_bool("GIT_FLUSH", -1);
+                       if (skip_stdout_flush < 0) {
+                               struct stat st;
+                               if (fstat(fileno(stdout), &st))
+                                       skip_stdout_flush = 0;
+                               else
+                                       skip_stdout_flush = S_ISREG(st.st_mode);
+                       }
                }
                if (skip_stdout_flush && !ferror(f))
                        return;