aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMykyta Holubakha <hilobakho@gmail.com>2017-01-16 01:05:05 +0200
committerMykyta Holubakha <hilobakho@gmail.com>2017-01-16 01:05:05 +0200
commit138bcd0cfae78ced64b98274adf6531d3161d828 (patch)
treeb1dcac22e3b5b7f4da6155598c66681608936c5b
parent81102e8eacbf72ad0c5e81c935a957a8824a0922 (diff)
Unset LD_LIBRARY_PATH, unless specified
-rw-r--r--CMakeLists.txt6
-rw-r--r--sway/main.c4
2 files changed, 8 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ea0e3648..74c79075 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -47,9 +47,11 @@ option(enable-swaymsg "Enables the swaymsg utility" YES)
option(enable-gdk-pixbuf "Use Pixbuf to support more image formats" YES)
option(zsh-completions "Zsh shell completions" NO)
option(default-wallpaper "Installs the default wallpaper" YES)
-set(LD_LIBRARY_PATH "/usr/lib" CACHE STRING "Configures sway's default LD_LIBRARY_PATH")
+option(LD_LIBRARY_PATH "Configure sway's default LD_LIBRARY_PATH")
-add_definitions(-D_LD_LIBRARY_PATH="${LD_LIBRARY_PATH}")
+if (LD_LIBRARY_PATH)
+ add_definitions(-D_LD_LIBRARY_PATH="${LD_LIBRARY_PATH}")
+endif()
find_package(JsonC REQUIRED)
find_package(PCRE REQUIRED)
diff --git a/sway/main.c b/sway/main.c
index 7bf71b53..1c4c56c0 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -214,7 +214,11 @@ int main(int argc, char **argv) {
// Security:
unsetenv("LD_PRELOAD");
+#ifdef _LD_LIBRARY_PATH
setenv("LD_LIBRARY_PATH", _LD_LIBRARY_PATH, 1);
+#else
+ unsetenv("LD_LIBRARY_PATH");
+#endif
int c;
while (1) {