|
@@ -24,6 +24,7 @@ static char *script_mkfifo(void)
|
|
{
|
|
{
|
|
int res = 0;
|
|
int res = 0;
|
|
char *name = NULL;
|
|
char *name = NULL;
|
|
|
|
+ int rc = 0;
|
|
|
|
|
|
name = faux_str_sprintf("/tmp/klish.fifo.%u.XXXXXX", getpid());
|
|
name = faux_str_sprintf("/tmp/klish.fifo.%u.XXXXXX", getpid());
|
|
mktemp(name);
|
|
mktemp(name);
|
|
@@ -142,10 +143,13 @@ static char *find_out_shebang(const char *script)
|
|
(strlen(line) < 2) ||
|
|
(strlen(line) < 2) ||
|
|
(line[0] != '#') ||
|
|
(line[0] != '#') ||
|
|
(line[1] != '!')
|
|
(line[1] != '!')
|
|
- )
|
|
|
|
|
|
+ ) {
|
|
|
|
+ faux_str_free(line);
|
|
return faux_str_dup(default_shebang);
|
|
return faux_str_dup(default_shebang);
|
|
|
|
+ }
|
|
|
|
|
|
shebang = faux_str_dup(line + 2);
|
|
shebang = faux_str_dup(line + 2);
|
|
|
|
+ faux_str_free(line);
|
|
|
|
|
|
return shebang;
|
|
return shebang;
|
|
}
|
|
}
|
|
@@ -186,6 +190,7 @@ int script_script(kcontext_t *context)
|
|
// Child: write to FIFO
|
|
// Child: write to FIFO
|
|
if (cpid == 0) {
|
|
if (cpid == 0) {
|
|
wpipe = fopen(fifo_name, "w");
|
|
wpipe = fopen(fifo_name, "w");
|
|
|
|
+ faux_str_free(fifo_name);
|
|
if (!wpipe)
|
|
if (!wpipe)
|
|
_exit(-1);
|
|
_exit(-1);
|
|
fwrite(script, strlen(script), 1, wpipe);
|
|
fwrite(script, strlen(script), 1, wpipe);
|