]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Fix usage of ferror after fclose
authorJoel Rosdahl <joel@rosdahl.net>
Wed, 1 May 2019 14:10:18 +0000 (16:10 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Wed, 1 May 2019 14:10:29 +0000 (16:10 +0200)
src/execute.c

index 3ee095346c46780013d72588688552d5dc4bddae..4ec3a0a972d8a9e04b36f699837c076981edf551 100644 (file)
@@ -175,10 +175,10 @@ win32execute(char *path, char **argv, int doreturn,
                FILE *fp = create_tmp_file(&tmp_file, "w");
                char atfile[MAX_PATH + 3];
                fwrite(args, 1, length, fp);
-               fclose(fp);
                if (ferror(fp)) {
                        cc_log("Error writing @file; this command will probably fail: %s", args);
                }
+               fclose(fp);
                snprintf(atfile, sizeof(atfile), "\"@%s\"", tmp_file);
                ret = CreateProcess(NULL, atfile, NULL, NULL, 1, 0, NULL, NULL,
                                    &si, &pi);