Skip to content

Commit

Permalink
Merge pull request #1050 from Hummer12007/cmake
Browse files Browse the repository at this point in the history
Unset LD_LIBRARY_PATH, unless specified
  • Loading branch information
ddevault authored Jan 16, 2017
2 parents 81102e8 + 138bcd0 commit 2047bb8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions sway/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 2047bb8

Please sign in to comment.