From f1b5ba34be4dcaab06ab19405a3f9f7b14346ef4 Mon Sep 17 00:00:00 2001 From: FlightlessMango Date: Thu, 1 Jun 2023 19:44:22 +0200 Subject: [PATCH] mangohud bin: Don't append library multiple times in LD_PRELOAD --- bin/mangohud.in | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/bin/mangohud.in b/bin/mangohud.in index 49f4ddf0..ab3075ea 100755 --- a/bin/mangohud.in +++ b/bin/mangohud.in @@ -15,8 +15,16 @@ if [ "$1" = "--dlsym" ]; then shift fi -# Preload using the plain filenames of the libs, the dynamic linker will -# figure out whether the 32 or 64 bit version should be used -LD_PRELOAD="${LD_PRELOAD:+$LD_PRELOAD:}${MANGOHUD_LIB_NAME}" +# Make sure we don't append mangohud lib multiple times +# otherwise this could cause issues with steam runtime +case ":${LD_PRELOAD-}:" in + (*:$MANGOHUD_LIB_NAME:*) + ;; + (*) + # Preload using the plain filenames of the libs, the dynamic linker will + # figure out whether the 32 or 64 bit version should be used + LD_PRELOAD="${LD_PRELOAD:+$LD_PRELOAD:}${MANGOHUD_LIB_NAME}" +esac + exec env MANGOHUD=1 LD_PRELOAD="${LD_PRELOAD}" "$@"