Use execlp("sh") instead of execl("/bin/sh")
This stops assuming the POSIX shell command is located in /bin.
This commit is contained in:
parent
e3e99d961d
commit
7beeb9e61b
|
@ -65,7 +65,7 @@ struct cmd_results *cmd_exec_process(int argc, char **argv) {
|
||||||
close(fd[0]);
|
close(fd[0]);
|
||||||
if ((child = fork()) == 0) {
|
if ((child = fork()) == 0) {
|
||||||
close(fd[1]);
|
close(fd[1]);
|
||||||
execl("/bin/sh", "/bin/sh", "-c", cmd, (void *)NULL);
|
execlp("sh", "sh", "-c", cmd, (void *)NULL);
|
||||||
_exit(0);
|
_exit(0);
|
||||||
}
|
}
|
||||||
ssize_t s = 0;
|
ssize_t s = 0;
|
||||||
|
|
|
@ -87,8 +87,8 @@ bool swaynag_spawn(const char *swaynag_command,
|
||||||
size_t length = strlen(swaynag_command) + strlen(swaynag->args) + 2;
|
size_t length = strlen(swaynag_command) + strlen(swaynag->args) + 2;
|
||||||
char *cmd = malloc(length);
|
char *cmd = malloc(length);
|
||||||
snprintf(cmd, length, "%s %s", swaynag_command, swaynag->args);
|
snprintf(cmd, length, "%s %s", swaynag_command, swaynag->args);
|
||||||
execl("/bin/sh", "/bin/sh", "-c", cmd, NULL);
|
execlp("sh", "sh", "-c", cmd, NULL);
|
||||||
sway_log_errno(SWAY_ERROR, "execl failed");
|
sway_log_errno(SWAY_ERROR, "execlp failed");
|
||||||
_exit(EXIT_FAILURE);
|
_exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
_exit(EXIT_SUCCESS);
|
_exit(EXIT_SUCCESS);
|
||||||
|
|
|
@ -30,8 +30,8 @@ static bool terminal_execute(char *terminal, char *command) {
|
||||||
chmod(fname, S_IRUSR | S_IWUSR | S_IXUSR);
|
chmod(fname, S_IRUSR | S_IWUSR | S_IXUSR);
|
||||||
char *cmd = malloc(sizeof(char) * (strlen(terminal) + strlen(" -e ") + strlen(fname) + 1));
|
char *cmd = malloc(sizeof(char) * (strlen(terminal) + strlen(" -e ") + strlen(fname) + 1));
|
||||||
sprintf(cmd, "%s -e %s", terminal, fname);
|
sprintf(cmd, "%s -e %s", terminal, fname);
|
||||||
execl("/bin/sh", "/bin/sh", "-c", cmd, NULL);
|
execlp("sh", "sh", "-c", cmd, NULL);
|
||||||
sway_log_errno(SWAY_ERROR, "Failed to run command, execl() returned.");
|
sway_log_errno(SWAY_ERROR, "Failed to run command, execlp() returned.");
|
||||||
free(cmd);
|
free(cmd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -69,8 +69,8 @@ static void swaynag_button_execute(struct swaynag *swaynag,
|
||||||
sway_log(SWAY_DEBUG,
|
sway_log(SWAY_DEBUG,
|
||||||
"$TERMINAL not found. Running directly");
|
"$TERMINAL not found. Running directly");
|
||||||
}
|
}
|
||||||
execl("/bin/sh", "/bin/sh", "-c", button->action, NULL);
|
execlp("sh", "sh", "-c", button->action, NULL);
|
||||||
sway_log_errno(SWAY_DEBUG, "execl failed");
|
sway_log_errno(SWAY_DEBUG, "execlp failed");
|
||||||
_exit(EXIT_FAILURE);
|
_exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue