diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2018-07-25 13:02:18 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2018-07-26 09:30:51 +0000 |
commit | cc25aa4cafbbb04cc652c79763c09ab7f584a4d5 (patch) | |
tree | a66d2158b39d0224148f501ebc0510177939be85 /src/libs/utils | |
parent | 7f6c48e0176ab1c723ad0fb428ce365ab2392e0b (diff) |
Environment: Do not leave stray ':' in LD_LIBRARY_PATH
A empty path segment in LD_LIBRARY_PATH is *not* ignored and treated
as '.' IIRC.
So make sure to not leave a ':' in first place of LD_LIBRARY_PATH or set
an empty LD_LIBRARY_PATH on Linux.
Change-Id: I99ec2e333c6c0205334daf14ac6a2373c6e465ad
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/libs/utils')
-rw-r--r-- | src/libs/utils/environment.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libs/utils/environment.cpp b/src/libs/utils/environment.cpp index e8e8938739e..1efbc024dd1 100644 --- a/src/libs/utils/environment.cpp +++ b/src/libs/utils/environment.cpp @@ -49,8 +49,10 @@ public: toReplace.append(':'); toReplace.append(lib.path()); - if (ldLibraryPath.startsWith(toReplace)) - set("LD_LIBRARY_PATH", ldLibraryPath.remove(0, toReplace.length())); + if (ldLibraryPath.startsWith(toReplace + ':')) + set("LD_LIBRARY_PATH", ldLibraryPath.remove(0, toReplace.length() + 1)); + else if (ldLibraryPath == toReplace) + unset("LD_LIBRARY_PATH"); } } }; |