forked from aniani/vim
patch 8.0.0842: using slave pty after closing it
Problem: Using slave pty after closing it. Solution: Do the ioctl() before dup'ing it.
This commit is contained in:
parent
5c838a3e71
commit
223896d3e9
@ -5316,6 +5316,17 @@ mch_job_start(char **argv, job_T *job, jobopt_T *options)
|
|||||||
if (use_null_for_in || use_null_for_out || use_null_for_err)
|
if (use_null_for_in || use_null_for_out || use_null_for_err)
|
||||||
null_fd = open("/dev/null", O_RDWR | O_EXTRA, 0);
|
null_fd = open("/dev/null", O_RDWR | O_EXTRA, 0);
|
||||||
|
|
||||||
|
if (pty_slave_fd >= 0)
|
||||||
|
{
|
||||||
|
/* push stream discipline modules */
|
||||||
|
SetupSlavePTY(pty_slave_fd);
|
||||||
|
# ifdef TIOCSCTTY
|
||||||
|
/* Try to become controlling tty (probably doesn't work,
|
||||||
|
* unless run by root) */
|
||||||
|
ioctl(pty_slave_fd, TIOCSCTTY, (char *)NULL);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
/* set up stdin for the child */
|
/* set up stdin for the child */
|
||||||
close(0);
|
close(0);
|
||||||
if (use_null_for_in && null_fd >= 0)
|
if (use_null_for_in && null_fd >= 0)
|
||||||
@ -5362,24 +5373,13 @@ mch_job_start(char **argv, job_T *job, jobopt_T *options)
|
|||||||
close(fd_err[1]);
|
close(fd_err[1]);
|
||||||
if (pty_master_fd >= 0)
|
if (pty_master_fd >= 0)
|
||||||
{
|
{
|
||||||
close(pty_master_fd); /* not used */
|
close(pty_master_fd); /* not used in the child */
|
||||||
close(pty_slave_fd); /* duped above */
|
close(pty_slave_fd); /* was duped above */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null_fd >= 0)
|
if (null_fd >= 0)
|
||||||
close(null_fd);
|
close(null_fd);
|
||||||
|
|
||||||
if (pty_slave_fd >= 0)
|
|
||||||
{
|
|
||||||
/* push stream discipline modules */
|
|
||||||
SetupSlavePTY(pty_slave_fd);
|
|
||||||
# ifdef TIOCSCTTY
|
|
||||||
/* Try to become controlling tty (probably doesn't work,
|
|
||||||
* unless run by root) */
|
|
||||||
ioctl(pty_slave_fd, TIOCSCTTY, (char *)NULL);
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/* See above for type of argv. */
|
/* See above for type of argv. */
|
||||||
execvp(argv[0], argv);
|
execvp(argv[0], argv);
|
||||||
|
|
||||||
|
@ -769,6 +769,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
842,
|
||||||
/**/
|
/**/
|
||||||
841,
|
841,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user