#include "util/hash_table.h"
#include "util/mesa-sha1.h"
#include "util/crc32.h"
+#include "util/os_file.h"
/**
* Return mask of GLSL_x flags by examining the MESA_GLSL env var.
const char *capture_path = _mesa_get_shader_capture_path();
if (shProg->Name != 0 && shProg->Name != ~0 && capture_path != NULL) {
/* Find an unused filename. */
+ FILE *file = NULL;
char *filename = NULL;
for (unsigned i = 0;; i++) {
if (i) {
filename = ralloc_asprintf(NULL, "%s/%u.shader_test",
capture_path, shProg->Name);
}
- FILE *file = fopen(filename, "r");
- if (!file)
+ file = os_file_create_unique(filename, 0644);
+ if (file)
break;
- fclose(file);
ralloc_free(filename);
}
-
- FILE *file = fopen(filename, "w");
if (file) {
fprintf(file, "[require]\nGLSL%s >= %u.%02u\n",
shProg->IsES ? " ES" : "",