Mesa (master): mesa: use os_file_create_unique()
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jun 28 22:47:35 UTC 2019
Module: Mesa
Branch: master
Commit: d02d2b626b7b7dd9ccb0e81b48c351cdf65156b3
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d02d2b626b7b7dd9ccb0e81b48c351cdf65156b3
Author: Eric Engestrom <eric.engestrom at intel.com>
Date: Wed Jun 12 15:46:11 2019 +0100
mesa: use os_file_create_unique()
Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg at google.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
---
src/mesa/main/shaderapi.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 584af9b8cef..f23e9c00be5 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -63,6 +63,7 @@
#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.
@@ -1241,6 +1242,7 @@ link_program(struct gl_context *ctx, struct gl_shader_program *shProg,
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) {
@@ -1250,14 +1252,11 @@ link_program(struct gl_context *ctx, struct gl_shader_program *shProg,
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" : "",
More information about the mesa-commit
mailing list