mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-18 03:28:07 -05:00
Switch round a bogus if statement I've just noticed. Both the write to
pty_utmp_helper_pipe _and_ the close of it if we're not going to write should be conditionalised on the pipe existing, rather than just the former! [originally from svn r9729]
This commit is contained in:
parent
7c22b1d755
commit
9a7dd918da
32
unix/uxpty.c
32
unix/uxpty.c
@ -748,21 +748,23 @@ static const char *pty_init(void *frontend, void **backend_handle, Conf *conf,
|
|||||||
* Stamp utmp (that is, tell the utmp helper process to do so),
|
* Stamp utmp (that is, tell the utmp helper process to do so),
|
||||||
* or not.
|
* or not.
|
||||||
*/
|
*/
|
||||||
if (!conf_get_int(conf, CONF_stamp_utmp)) {
|
if (pty_utmp_helper_pipe >= 0) { /* if it's < 0, we can't anyway */
|
||||||
close(pty_utmp_helper_pipe); /* just let the child process die */
|
if (!conf_get_int(conf, CONF_stamp_utmp)) {
|
||||||
pty_utmp_helper_pipe = -1;
|
close(pty_utmp_helper_pipe); /* just let the child process die */
|
||||||
} else if (pty_utmp_helper_pipe >= 0) {
|
pty_utmp_helper_pipe = -1;
|
||||||
char *location = get_x_display(pty->frontend);
|
} else {
|
||||||
int len = strlen(location)+1, pos = 0; /* +1 to include NUL */
|
char *location = get_x_display(pty->frontend);
|
||||||
while (pos < len) {
|
int len = strlen(location)+1, pos = 0; /* +1 to include NUL */
|
||||||
int ret = write(pty_utmp_helper_pipe, location+pos, len - pos);
|
while (pos < len) {
|
||||||
if (ret < 0) {
|
int ret = write(pty_utmp_helper_pipe, location+pos, len - pos);
|
||||||
perror("pterm: writing to utmp helper process");
|
if (ret < 0) {
|
||||||
close(pty_utmp_helper_pipe); /* arrgh, just give up */
|
perror("pterm: writing to utmp helper process");
|
||||||
pty_utmp_helper_pipe = -1;
|
close(pty_utmp_helper_pipe); /* arrgh, just give up */
|
||||||
break;
|
pty_utmp_helper_pipe = -1;
|
||||||
}
|
break;
|
||||||
pos += ret;
|
}
|
||||||
|
pos += ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user