From bdeb1e7c4c63ad278dd4b2f8fd6fccb7651c3e6f Mon Sep 17 00:00:00 2001 From: Bakkeby Date: Thu, 11 Aug 2022 15:04:44 +0200 Subject: [PATCH] openurlonclick: using posix_spawnp instead of system ref. comments in #76 --- patch/openurlonclick.c | 7 ++++--- patch/openurlonclick.h | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/patch/openurlonclick.c b/patch/openurlonclick.c index 8920359..626cde6 100644 --- a/patch/openurlonclick.c +++ b/patch/openurlonclick.c @@ -133,8 +133,9 @@ openUrlOnClick(int col, int row, char* url_opener) { char *url = detecturl(col, row, 1); if (url) { - char command[strlen(url_opener) + strlen(url) + 5]; - sprintf(command, "%s \"%s\"&", url_opener, url); - system(command); + extern char **environ; + pid_t junk; + char *argv[] = { url_opener, url, NULL }; + posix_spawnp(&junk, argv[0], NULL, NULL, argv, environ); } } diff --git a/patch/openurlonclick.h b/patch/openurlonclick.h index 10f21ce..5aa09de 100644 --- a/patch/openurlonclick.h +++ b/patch/openurlonclick.h @@ -1,3 +1,5 @@ +#include + static inline void restoremousecursor(void) { if (!(win.mode & MODE_MOUSE) && xw.pointerisvisible) XDefineCursor(xw.dpy, xw.win, xw.vpointer);