mesa: stop trying new filenames if the filename existing is not the issue
authorEric Engestrom <eric.engestrom@intel.com>
Sat, 22 Jun 2019 12:49:02 +0000 (13:49 +0100)
committerEric Engestrom <eric.engestrom@intel.com>
Fri, 28 Jun 2019 22:37:49 +0000 (23:37 +0100)
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/main/shaderapi.c

index f23e9c00be58607cb5b271555f77990368f76503..e06ab00bb0b35bd3987bc77fb223861a5ba31a3b 100644 (file)
@@ -37,6 +37,7 @@
  */
 
 
+#include <errno.h>
 #include <stdbool.h>
 #include <c99_alloca.h>
 #include "main/glheader.h"
@@ -1255,6 +1256,11 @@ link_program(struct gl_context *ctx, struct gl_shader_program *shProg,
          file = os_file_create_unique(filename, 0644);
          if (file)
             break;
+         /* If we are failing for another reason than "this filename already
+          * exists", we are likely to fail again with another filename, so
+          * let's just give up */
+         if (errno != EEXIST)
+            break;
          ralloc_free(filename);
       }
       if (file) {