openurlonclick: using posix_spawnp instead of system ref. comments in #76

This commit is contained in:
Bakkeby 2022-08-11 15:04:44 +02:00
parent 2eca262969
commit bdeb1e7c4c
2 changed files with 6 additions and 3 deletions

View File

@ -133,8 +133,9 @@ openUrlOnClick(int col, int row, char* url_opener)
{ {
char *url = detecturl(col, row, 1); char *url = detecturl(col, row, 1);
if (url) { if (url) {
char command[strlen(url_opener) + strlen(url) + 5]; extern char **environ;
sprintf(command, "%s \"%s\"&", url_opener, url); pid_t junk;
system(command); char *argv[] = { url_opener, url, NULL };
posix_spawnp(&junk, argv[0], NULL, NULL, argv, environ);
} }
} }

View File

@ -1,3 +1,5 @@
#include <spawn.h>
static inline void restoremousecursor(void) { static inline void restoremousecursor(void) {
if (!(win.mode & MODE_MOUSE) && xw.pointerisvisible) if (!(win.mode & MODE_MOUSE) && xw.pointerisvisible)
XDefineCursor(xw.dpy, xw.win, xw.vpointer); XDefineCursor(xw.dpy, xw.win, xw.vpointer);