mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-18 05:34:02 -04:00
main: allow user to override shell on the command line
This commit is contained in:
parent
2046dc0fbd
commit
c11cc2be57
3 changed files with 21 additions and 11 deletions
9
slave.c
9
slave.c
|
|
@ -11,18 +11,13 @@
|
|||
#define LOG_MODULE "slave"
|
||||
#define LOG_ENABLE_DBG 0
|
||||
#include "log.h"
|
||||
#include "tokenize.h"
|
||||
|
||||
void
|
||||
slave_spawn(int ptmx, char *cmd, int err_fd)
|
||||
slave_spawn(int ptmx, char *const argv[], int err_fd)
|
||||
{
|
||||
int pts = -1;
|
||||
const char *pts_name = ptsname(ptmx);
|
||||
|
||||
char **argv = NULL;
|
||||
if (!tokenize_cmdline(cmd, &argv))
|
||||
goto err;
|
||||
|
||||
if (grantpt(ptmx) == -1) {
|
||||
LOG_ERRNO("failed to grantpt()");
|
||||
goto err;
|
||||
|
|
@ -61,8 +56,6 @@ slave_spawn(int ptmx, char *cmd, int err_fd)
|
|||
|
||||
err:
|
||||
(void)!write(err_fd, &errno, sizeof(errno));
|
||||
if (argv)
|
||||
free(argv);
|
||||
if (pts != -1)
|
||||
close(pts);
|
||||
if (ptmx != -1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue