brw,elk: Fix opening flags on dumping shader binaries

Truncation is needed for overwriting correctly in cases when old file is
bigger than the one we want to dump (e.g. when the old one was edited
inplace). Also, creation permissions are way too broad.

Fixes: 4f41c44d ("intel/compiler: Add variable to dump binaries of all compiled shaders")
Signed-off-by: Sviatoslav Peleshko <sviatoslav.peleshko@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30581>
This commit is contained in:
Sviatoslav Peleshko
2024-08-08 23:51:35 +03:00
committed by Marge Bot
parent 442cc7996e
commit 09122e2be0
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -310,7 +310,7 @@ void brw_dump_shader_bin(void *assembly, int start_offset, int end_offset,
debug_get_option_shader_bin_dump_path(),
identifier);
int fd = open(name, O_CREAT | O_WRONLY, 0777);
int fd = open(name, O_CREAT | O_WRONLY | O_TRUNC, 0644);
ralloc_free(name);
if (fd < 0)
+1 -1
View File
@@ -376,7 +376,7 @@ void elk_dump_shader_bin(void *assembly, int start_offset, int end_offset,
debug_get_option_shader_bin_dump_path(),
identifier);
int fd = open(name, O_CREAT | O_WRONLY, 0777);
int fd = open(name, O_CREAT | O_WRONLY | O_TRUNC, 0644);
ralloc_free(name);
if (fd < 0)