diff options
author | Damien Miller <djm@mindrot.org> | 2011-01-16 23:16:53 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2011-01-16 23:16:53 +1100 |
commit | 4791f9dcecb89f5601d8b20e2e6b43dce6f25755 (patch) | |
tree | 3763f5fb56427034073452dda2f9c16318591457 /clientloop.c | |
parent | 50c61f88abdb356d45026dc1427ddb461b626e45 (diff) |
- djm@cvs.openbsd.org 2011/01/16 11:50:05
[clientloop.c]
Use atomicio when flushing protocol 1 std{out,err} buffers at
session close. This was a latent bug exposed by setting a SIGCHLD
handler and spotted by kevin.brott AT gmail.com; ok dtucker@
Diffstat (limited to 'clientloop.c')
-rw-r--r-- | clientloop.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/clientloop.c b/clientloop.c index c60b758c7..325657ba2 100644 --- a/clientloop.c +++ b/clientloop.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: clientloop.c,v 1.229 2011/01/11 06:13:10 djm Exp $ */ | 1 | /* $OpenBSD: clientloop.c,v 1.230 2011/01/16 11:50:05 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -1591,9 +1591,9 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id) | |||
1591 | 1591 | ||
1592 | /* Output any buffered data for stdout. */ | 1592 | /* Output any buffered data for stdout. */ |
1593 | while (buffer_len(&stdout_buffer) > 0) { | 1593 | while (buffer_len(&stdout_buffer) > 0) { |
1594 | len = write(fileno(stdout), buffer_ptr(&stdout_buffer), | 1594 | len = atomicio(vwrite, fileno(stdout), |
1595 | buffer_len(&stdout_buffer)); | 1595 | buffer_ptr(&stdout_buffer), buffer_len(&stdout_buffer)); |
1596 | if (len <= 0) { | 1596 | if (len != buffer_len(&stdout_buffer)) { |
1597 | error("Write failed flushing stdout buffer."); | 1597 | error("Write failed flushing stdout buffer."); |
1598 | break; | 1598 | break; |
1599 | } | 1599 | } |
@@ -1602,9 +1602,9 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id) | |||
1602 | 1602 | ||
1603 | /* Output any buffered data for stderr. */ | 1603 | /* Output any buffered data for stderr. */ |
1604 | while (buffer_len(&stderr_buffer) > 0) { | 1604 | while (buffer_len(&stderr_buffer) > 0) { |
1605 | len = write(fileno(stderr), buffer_ptr(&stderr_buffer), | 1605 | len = atomicio(vwrite, fileno(stderr), |
1606 | buffer_len(&stderr_buffer)); | 1606 | buffer_ptr(&stderr_buffer), buffer_len(&stderr_buffer)); |
1607 | if (len <= 0) { | 1607 | if (len != buffer_len(&stderr_buffer)) { |
1608 | error("Write failed flushing stderr buffer."); | 1608 | error("Write failed flushing stderr buffer."); |
1609 | break; | 1609 | break; |
1610 | } | 1610 | } |