[vlc-devel] [PATCH] linux/dirs: fix condition checks

Zhao Zhili quinkblack at foxmail.com
Thu Nov 1 03:59:55 CET 2018


---
 src/linux/dirs.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/linux/dirs.c b/src/linux/dirs.c
index f5dbdaa..b8ad5b9 100644
--- a/src/linux/dirs.c
+++ b/src/linux/dirs.c
@@ -60,10 +60,11 @@ static char *config_GetLibDirRaw(void)
         if (dir == NULL)
             continue;
 
-        char *file = strrchr (line, '/');
-        if (end == NULL)
-            continue;
-        *file = '\0';
+        char *file = strrchr (dir, '/');
+        if (likely(file != dir))
+            *file = '\0';
+        else /* install libs at the root directory, unlikely */
+            *(file + 1) = '\0';
 
         path = strdup(dir);
         break;
-- 
2.9.5



More information about the vlc-devel mailing list