From d38d9a80da3ee7cd9ab579b75e575000c25310df Mon Sep 17 00:00:00 2001 From: djm Date: Fri, 4 Jul 2008 23:40:56 +0000 Subject: [PATCH] - OpenBSD CVS Sync - djm@cvs.openbsd.org 2008/07/04 23:08:25 [packet.c] handle EINTR in packet_write_poll()l ok dtucker@ --- ChangeLog | 4 ++++ packet.c | 13 ++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0db459f9..4af616da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ - (djm) [atomicio.c configure.ac] Disable poll() fallback in atomiciov for Tru64. readv doesn't seem to be a comparable object there. bz#1386, patch from dtucker@ ok me + - (djm) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2008/07/04 23:08:25 + [packet.c] + handle EINTR in packet_write_poll()l ok dtucker@ 20080704 - (dtucker) OpenBSD CVS Sync diff --git a/packet.c b/packet.c index ff22be68..1dda4a29 100644 --- a/packet.c +++ b/packet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: packet.c,v 1.155 2008/06/13 09:44:36 deraadt Exp $ */ +/* $OpenBSD: packet.c,v 1.156 2008/07/04 23:08:25 djm Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -1475,16 +1475,19 @@ packet_write_poll(void) if (len > 0) { len = write(connection_out, buffer_ptr(&output), len); - if (len <= 0) { - if (errno == EAGAIN || errno == EWOULDBLOCK) + if (len == -1) { + if (errno == EINTR || errno == EAGAIN || + errno == EWOULDBLOCK) return; - else - fatal("Write failed: %.100s", strerror(errno)); + fatal("Write failed: %.100s", strerror(errno)); } + if (len == 0) + fatal("Write connection closed"); buffer_consume(&output, len); } } + /* * Calls packet_write_poll repeatedly until all pending output data has been * written. -- 2.45.2