diff options
Diffstat (limited to 'channels.c')
-rw-r--r-- | channels.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/channels.c b/channels.c index 9cf85a38d..12db962de 100644 --- a/channels.c +++ b/channels.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: channels.c,v 1.319 2012/12/02 20:46:11 djm Exp $ */ | 1 | /* $OpenBSD: channels.c,v 1.320 2013/04/06 16:07:00 markus 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 |
@@ -1324,7 +1324,7 @@ channel_post_x11_listener(Channel *c, fd_set *readset, fd_set *writeset) | |||
1324 | { | 1324 | { |
1325 | Channel *nc; | 1325 | Channel *nc; |
1326 | struct sockaddr_storage addr; | 1326 | struct sockaddr_storage addr; |
1327 | int newsock; | 1327 | int newsock, oerrno; |
1328 | socklen_t addrlen; | 1328 | socklen_t addrlen; |
1329 | char buf[16384], *remote_ipaddr; | 1329 | char buf[16384], *remote_ipaddr; |
1330 | int remote_port; | 1330 | int remote_port; |
@@ -1334,12 +1334,16 @@ channel_post_x11_listener(Channel *c, fd_set *readset, fd_set *writeset) | |||
1334 | addrlen = sizeof(addr); | 1334 | addrlen = sizeof(addr); |
1335 | newsock = accept(c->sock, (struct sockaddr *)&addr, &addrlen); | 1335 | newsock = accept(c->sock, (struct sockaddr *)&addr, &addrlen); |
1336 | if (c->single_connection) { | 1336 | if (c->single_connection) { |
1337 | oerrno = errno; | ||
1337 | debug2("single_connection: closing X11 listener."); | 1338 | debug2("single_connection: closing X11 listener."); |
1338 | channel_close_fd(&c->sock); | 1339 | channel_close_fd(&c->sock); |
1339 | chan_mark_dead(c); | 1340 | chan_mark_dead(c); |
1341 | errno = oerrno; | ||
1340 | } | 1342 | } |
1341 | if (newsock < 0) { | 1343 | if (newsock < 0) { |
1342 | error("accept: %.100s", strerror(errno)); | 1344 | if (errno != EINTR && errno != EWOULDBLOCK && |
1345 | errno != ECONNABORTED) | ||
1346 | error("accept: %.100s", strerror(errno)); | ||
1343 | if (errno == EMFILE || errno == ENFILE) | 1347 | if (errno == EMFILE || errno == ENFILE) |
1344 | c->notbefore = time(NULL) + 1; | 1348 | c->notbefore = time(NULL) + 1; |
1345 | return; | 1349 | return; |
@@ -1484,7 +1488,9 @@ channel_post_port_listener(Channel *c, fd_set *readset, fd_set *writeset) | |||
1484 | addrlen = sizeof(addr); | 1488 | addrlen = sizeof(addr); |
1485 | newsock = accept(c->sock, (struct sockaddr *)&addr, &addrlen); | 1489 | newsock = accept(c->sock, (struct sockaddr *)&addr, &addrlen); |
1486 | if (newsock < 0) { | 1490 | if (newsock < 0) { |
1487 | error("accept: %.100s", strerror(errno)); | 1491 | if (errno != EINTR && errno != EWOULDBLOCK && |
1492 | errno != ECONNABORTED) | ||
1493 | error("accept: %.100s", strerror(errno)); | ||
1488 | if (errno == EMFILE || errno == ENFILE) | 1494 | if (errno == EMFILE || errno == ENFILE) |
1489 | c->notbefore = time(NULL) + 1; | 1495 | c->notbefore = time(NULL) + 1; |
1490 | return; | 1496 | return; |