diff options
author | John Ankarstrom <john@ankarstrom.se> | 2021-07-02 19:13:05 +0200 |
---|---|---|
committer | John Ankarstrom <john@ankarstrom.se> | 2021-07-02 19:13:05 +0200 |
commit | f1ba4fb2e7772597ca11e581c452d83ee75efd8d (patch) | |
tree | 24132271824220858d8744d43333d2b6c015ea2e | |
parent | 98a3dc992f26007b6862d1afc4e0aa42f9795307 (diff) | |
download | dwim-f1ba4fb2e7772597ca11e581c452d83ee75efd8d.tar.gz |
xchord: Use vfork + exec instead of system
-rw-r--r-- | xchord.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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; } |