From f5f9657506d2cd53a7849726902125cece7e745e Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Fri, 11 Dec 2020 17:01:40 +0000
Subject: [PATCH] runtime: Collect s2tc with correct precedence

Because capsule-capture-libs doesn't overwrite existing symbolic links,
in the unlikely event that s2tc exists in more than one directory in
the search path, we want to look at the highest-precedence first.

The reversed order was correct for the current implementation of
collecting DRI drivers, but not for s2tc.

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 pressure-vessel/runtime.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pressure-vessel/runtime.c b/pressure-vessel/runtime.c
index 85d33a964..1b87ae94c 100644
--- a/pressure-vessel/runtime.c
+++ b/pressure-vessel/runtime.c
@@ -3538,9 +3538,12 @@ pv_runtime_use_provider_graphics_stack (PvRuntime *self,
                                  g_ptr_array_index (dirs, dirs->len - 1 - j),
                                  error))
                 return FALSE;
+            }
 
+          for (j = 0; j < dirs->len; j++)
+            {
               if (!collect_s2tc (self, arch,
-                                 g_ptr_array_index (dirs, dirs->len - 1 - j),
+                                 g_ptr_array_index (dirs, j),
                                  error))
                 return FALSE;
             }
-- 
GitLab