Skip to content

Commit

Permalink
fix bug regarding open_with
Browse files Browse the repository at this point in the history
- dont free resources before using them
- move ext_shect back to child process, this wasnt the problem
- resolves #22
  • Loading branch information
Ckath committed Sep 14, 2019
1 parent 7ef0c05 commit c52a234
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions fuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,13 @@ open_with(char *launcher, char *file, bool cli)
/* reset sigchld handler, might want to wait */
signal(SIGCHLD, SIG_DFL);

ext_shesc(file);
pid_t pid = fork();
if (!pid) { /* child: open file */
free(items);
char cmd[PATH_MAX];
sprintf(cmd, cli ? file ? "%s \"%s\"":"%s":
file ? "%s \"%s\" &>/dev/null":"%s &>/dev/null",
launcher, file);
launcher, ext_shesc(file));
free(items);
execl("/bin/bash", "bash", "-c", cmd, NULL);
_exit(1);
} else { /* parent: check launched process */
Expand Down

0 comments on commit c52a234

Please sign in to comment.