aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarstrom <john@ankarstrom.se>2021-07-02 19:13:05 +0200
committerJohn Ankarstrom <john@ankarstrom.se>2021-07-02 19:13:05 +0200
commitf1ba4fb2e7772597ca11e581c452d83ee75efd8d (patch)
tree24132271824220858d8744d43333d2b6c015ea2e
parent98a3dc992f26007b6862d1afc4e0aa42f9795307 (diff)
downloaddwim-f1ba4fb2e7772597ca11e581c452d83ee75efd8d.tar.gz
xchord: Use vfork + exec instead of system
-rw-r--r--xchord.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/xchord.c b/xchord.c
index 59d3f52..ff1c755 100644
--- a/xchord.c
+++ b/xchord.c
@@ -16,6 +16,7 @@
* xchord is written by John Ankarström <john (at) ankarstrom.se>.
*/
+#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -85,7 +86,10 @@ main(int argc, char *argv[])
/* button 1 released */
if (rev->detail == 1) p1 = 0;
/* button 1 pressed + 3 released */
- if (p1 && rev->detail == 3) system("dwim");
+ if (p1 && rev->detail == 3 && vfork() == 0) {
+ execlp("dwim", "dwim", NULL);
+ err(1, "execlp");
+ }
break;
}