]> code.delx.au - spectrwm/blobdiff - spectrwm.c
Prepend SWM_LIB to LD_PRELOAD instead of clobbering.
[spectrwm] / spectrwm.c
index 37b0d2e101dee127d32f13c7b9983f3a80af975d..e566741c6d885136f2b331d47add86620fe844df 100644 (file)
@@ -3712,7 +3712,16 @@ spawn(int ws_idx, union arg *args, bool close_fd)
 
        close(xcb_get_file_descriptor(conn));
 
-       setenv("LD_PRELOAD", SWM_LIB, 1);
+       if ((ret = getenv("LD_PRELOAD"))) {
+               if (asprintf(&ret, "%s:%s", SWM_LIB, ret) == -1) {
+                       warn("spawn: asprintf LD_PRELOAD");
+                       _exit(1);
+               }
+               setenv("LD_PRELOAD", ret, 1);
+               free(ret);
+       } else {
+               setenv("LD_PRELOAD", SWM_LIB, 1);
+       }
 
        if (asprintf(&ret, "%d", ws_idx) == -1) {
                warn("spawn: asprintf SWM_WS");