mirror of git://anongit.mindrot.org/openssh.git
- djm@cvs.openbsd.org 2007/06/12 11:11:08
[ssh.c] fix slave exit value when a control master goes away without passing the full exit status by ensuring that the slave reads a full int. bz#1261 reported by frekko AT gmail.com; ok markus@ dtucker@
This commit is contained in:
parent
43ce902449
commit
2cbec749d7
|
@ -18,6 +18,11 @@
|
||||||
depends on the platform supporting sane O_NONBLOCK semantics for open
|
depends on the platform supporting sane O_NONBLOCK semantics for open
|
||||||
on FIFOs (apparently POSIX does not mandate this), which OpenBSD does.
|
on FIFOs (apparently POSIX does not mandate this), which OpenBSD does.
|
||||||
bz #856; report by cjwatson AT debian.org; ok markus@
|
bz #856; report by cjwatson AT debian.org; ok markus@
|
||||||
|
- djm@cvs.openbsd.org 2007/06/12 11:11:08
|
||||||
|
[ssh.c]
|
||||||
|
fix slave exit value when a control master goes away without passing the
|
||||||
|
full exit status by ensuring that the slave reads a full int. bz#1261
|
||||||
|
reported by frekko AT gmail.com; ok markus@ dtucker@
|
||||||
|
|
||||||
20070611
|
20070611
|
||||||
- (djm) Bugzilla #1306: silence spurious error messages from hang-on-exit
|
- (djm) Bugzilla #1306: silence spurious error messages from hang-on-exit
|
||||||
|
@ -3032,4 +3037,4 @@
|
||||||
OpenServer 6 and add osr5bigcrypt support so when someone migrates
|
OpenServer 6 and add osr5bigcrypt support so when someone migrates
|
||||||
passwords between UnixWare and OpenServer they will still work. OK dtucker@
|
passwords between UnixWare and OpenServer they will still work. OK dtucker@
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.4692 2007/06/12 13:41:06 dtucker Exp $
|
$Id: ChangeLog,v 1.4693 2007/06/12 13:41:33 dtucker Exp $
|
||||||
|
|
23
ssh.c
23
ssh.c
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: ssh.c,v 1.295 2007/01/03 03:01:40 stevesk Exp $ */
|
/* $OpenBSD: ssh.c,v 1.296 2007/06/12 11:11:08 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||||
|
@ -1458,25 +1458,28 @@ control_client(const char *path)
|
||||||
|
|
||||||
/* Stick around until the controlee closes the client_fd */
|
/* Stick around until the controlee closes the client_fd */
|
||||||
exitval = 0;
|
exitval = 0;
|
||||||
for (;!control_client_terminate;) {
|
for (i = 0; !control_client_terminate && i < (int)sizeof(exitval);) {
|
||||||
r = read(sock, &exitval, sizeof(exitval));
|
r = read(sock, (char *)&exitval + i, sizeof(exitval) - i);
|
||||||
if (r == 0) {
|
if (r == 0) {
|
||||||
debug2("Received EOF from master");
|
debug2("Received EOF from master");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (r > 0)
|
|
||||||
debug2("Received exit status from master %d", exitval);
|
|
||||||
if (r == -1 && errno != EINTR)
|
if (r == -1 && errno != EINTR)
|
||||||
fatal("%s: read %s", __func__, strerror(errno));
|
fatal("%s: read %s", __func__, strerror(errno));
|
||||||
|
i += r;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (control_client_terminate)
|
|
||||||
debug2("Exiting on signal %d", control_client_terminate);
|
|
||||||
|
|
||||||
close(sock);
|
close(sock);
|
||||||
|
|
||||||
leave_raw_mode();
|
leave_raw_mode();
|
||||||
|
|
||||||
|
if (control_client_terminate) {
|
||||||
|
debug2("Exiting on signal %d", control_client_terminate);
|
||||||
|
exitval = 255;
|
||||||
|
} else if (i < (int)sizeof(exitval)) {
|
||||||
|
debug2("Control master terminated unexpectedly");
|
||||||
|
exitval = 255;
|
||||||
|
} else
|
||||||
|
debug2("Received exit status from master %d", exitval);
|
||||||
|
|
||||||
if (tty_flag && options.log_level != SYSLOG_LEVEL_QUIET)
|
if (tty_flag && options.log_level != SYSLOG_LEVEL_QUIET)
|
||||||
fprintf(stderr, "Connection to master closed.\r\n");
|
fprintf(stderr, "Connection to master closed.\r\n");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue