diff options
author | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-02-18 14:59:15 +0100 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-02-18 16:00:18 +0100 |
commit | 9a8ea7ff91486b53511d49a1b1bb44d48a549018 (patch) | |
tree | ce9384198188d79a251d1c23102f86c942691273 | |
parent | fb58416f459ecac570e2f2cb76672379eecf2da0 (diff) | |
download | calcurse-9a8ea7ff91486b53511d49a1b1bb44d48a549018.zip |
src/io.c: Use fork_exec() instead of system()
Speeds up execution, prevents failures when pager or log file contains
spaces, fixes a warning seen with "-Wunused-result".
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
-rw-r--r-- | src/io.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1230,10 +1230,11 @@ io_log_display (struct io_file *log, char *msg, char *pager) ans = fgetc (stdin); if (ans == 'y') { - char cmd[BUFSIZ]; + char *arg[] = { pager, log->name, NULL }; + int pid; - snprintf (cmd, BUFSIZ, "%s %s", pager, log->name); - system (cmd); + if ((pid = fork_exec (NULL, NULL, pager, arg))) + child_wait (NULL, NULL, pid); } } else |