main: allow user to override shell on the command line

This commit is contained in:
Daniel Eklöf 2019-07-17 09:55:36 +02:00
parent 2046dc0fbd
commit c11cc2be57
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 21 additions and 11 deletions

View file

@ -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)