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
* doesn't like being run in setuid/setgid programs (probably
int pipefd[2];
#endif
- pty = single_pty = snew(struct pty_tag);
- pty->conf = NULL;
- bufchain_init(&pty->output_data);
+ pty = single_pty = new_pty_struct();
/* set the child signal handler straight away; it needs to be set
* before we ever fork. */
pty = single_pty;
assert(pty->conf == NULL);
} else {
- pty = snew(struct pty_tag);
+ pty = new_pty_struct();
pty->master_fd = pty->slave_fd = -1;
#ifndef OMIT_UTMP
pty_stamped_utmp = FALSE;
del234(ptys_by_pid, pty);
del234(ptys_by_fd, pty);
+ bufchain_clear(&pty->output_data);
+
conf_free(pty->conf);
pty->conf = NULL;