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>
This commit is contained in:
parent
fb58416f45
commit
9a8ea7ff91
7
src/io.c
7
src/io.c
@ -1230,10 +1230,11 @@ io_log_display (struct io_file *log, char *msg, char *pager)
|
|||||||
ans = fgetc (stdin);
|
ans = fgetc (stdin);
|
||||||
if (ans == 'y')
|
if (ans == 'y')
|
||||||
{
|
{
|
||||||
char cmd[BUFSIZ];
|
char *arg[] = { pager, log->name, NULL };
|
||||||
|
int pid;
|
||||||
|
|
||||||
snprintf (cmd, BUFSIZ, "%s %s", pager, log->name);
|
if ((pid = fork_exec (NULL, NULL, pager, arg)))
|
||||||
system (cmd);
|
child_wait (NULL, NULL, pid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user