mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-25 01:02:24 +00:00
Fix an uninitialised bufchain in NO_PTY_PRE_INIT mode.
The Pty that we created in pty_pre_init had its bufchain properly initialised, but if that one didn't get created, then the one we create in pty_init did not. Now both should go through the same init routine.
This commit is contained in:
parent
976e778269
commit
7658b291db
16
unix/uxpty.c
16
unix/uxpty.c
@ -395,6 +395,14 @@ static void pty_open_master(Pty pty)
|
|||||||
add234(ptys_by_fd, pty);
|
add234(ptys_by_fd, pty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Pty new_pty_struct(void)
|
||||||
|
{
|
||||||
|
Pty pty = snew(struct pty_tag);
|
||||||
|
pty->conf = NULL;
|
||||||
|
bufchain_init(&pty->output_data);
|
||||||
|
return pty;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Pre-initialisation. This is here to get around the fact that GTK
|
* Pre-initialisation. This is here to get around the fact that GTK
|
||||||
* doesn't like being run in setuid/setgid programs (probably
|
* doesn't like being run in setuid/setgid programs (probably
|
||||||
@ -419,9 +427,7 @@ void pty_pre_init(void)
|
|||||||
int pipefd[2];
|
int pipefd[2];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pty = single_pty = snew(struct pty_tag);
|
pty = single_pty = new_pty_struct();
|
||||||
pty->conf = NULL;
|
|
||||||
bufchain_init(&pty->output_data);
|
|
||||||
|
|
||||||
/* set the child signal handler straight away; it needs to be set
|
/* set the child signal handler straight away; it needs to be set
|
||||||
* before we ever fork. */
|
* before we ever fork. */
|
||||||
@ -740,7 +746,7 @@ static const char *pty_init(void *frontend, void **backend_handle, Conf *conf,
|
|||||||
pty = single_pty;
|
pty = single_pty;
|
||||||
assert(pty->conf == NULL);
|
assert(pty->conf == NULL);
|
||||||
} else {
|
} else {
|
||||||
pty = snew(struct pty_tag);
|
pty = new_pty_struct();
|
||||||
pty->master_fd = pty->slave_fd = -1;
|
pty->master_fd = pty->slave_fd = -1;
|
||||||
#ifndef OMIT_UTMP
|
#ifndef OMIT_UTMP
|
||||||
pty_stamped_utmp = FALSE;
|
pty_stamped_utmp = FALSE;
|
||||||
@ -998,6 +1004,8 @@ static void pty_free(void *handle)
|
|||||||
del234(ptys_by_pid, pty);
|
del234(ptys_by_pid, pty);
|
||||||
del234(ptys_by_fd, pty);
|
del234(ptys_by_fd, pty);
|
||||||
|
|
||||||
|
bufchain_clear(&pty->output_data);
|
||||||
|
|
||||||
conf_free(pty->conf);
|
conf_free(pty->conf);
|
||||||
pty->conf = NULL;
|
pty->conf = NULL;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user