summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2012-02-18 14:59:15 +0100
committerLukas Fleischer <calcurse@cryptocrack.de>2012-02-18 16:00:18 +0100
commit9a8ea7ff91486b53511d49a1b1bb44d48a549018 (patch)
treece9384198188d79a251d1c23102f86c942691273
parentfb58416f459ecac570e2f2cb76672379eecf2da0 (diff)
downloadcalcurse-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.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/io.c b/src/io.c
index 1aa431b..6c981d4 100644
--- a/src/io.c
+++ b/src/io.c
@@ -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