diff options
author | Joe Dight <joe.dight@ntmail.uk> | 2022-06-28 12:47:06 +0100 |
---|---|---|
committer | Joe Dight <joe.dight@ntmail.uk> | 2022-06-28 13:18:18 +0100 |
commit | e18d0be2fb036f0832f4aaadc369359f9d19bf4a (patch) | |
tree | 1120c44874d47e5e205d524c4544e86398e8fdb9 | |
parent | 7ab36f2732c84ee6cebdcfbd6d22b55a46979202 (diff) |
Pass cell contents correctly when following links
-rw-r--r-- | src/file.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -2172,10 +2172,13 @@ int backup_exists(char * file) { void openfile_nested(char * file) { char * cmd = get_conf_value("default_open_file_under_cursor_cmd"); if (cmd == NULL || ! strlen(cmd)) return; - char syscmd[PATHLEN + strlen(cmd)]; - sprintf(syscmd, "%s", cmd); - sprintf(syscmd + strlen(syscmd), " %s", file); - system(syscmd); + pid_t pid = fork(); + if (pid == 0) { + execlp(cmd, cmd, file, NULL); + exit(EXIT_FAILURE); + } else if (pid > 0) { + waitpid(pid, NULL, 0); + } } |