summaryrefslogtreecommitdiffstats
path: root/usr.sbin/iscsid
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2014-04-21 12:26:50 +0000
committerclaudio <claudio@openbsd.org>2014-04-21 12:26:50 +0000
commitf9cc11ec63a921c1bbc5eb25dc0227ef4af699b4 (patch)
tree92065b5d71332fa8c35487bff90036aff51a3aaf /usr.sbin/iscsid
parentIt is possible that we can't burst all of the data in the immediate data (diff)
downloadwireguard-openbsd-f9cc11ec63a921c1bbc5eb25dc0227ef4af699b4.tar.xz
wireguard-openbsd-f9cc11ec63a921c1bbc5eb25dc0227ef4af699b4.zip
Handle EAGAIN, ENOBUFS and EINTR a bit better. Ignore them one layer above
and do not fail and tear down the world when they happen.
Diffstat (limited to 'usr.sbin/iscsid')
-rw-r--r--usr.sbin/iscsid/connection.c6
-rw-r--r--usr.sbin/iscsid/pdu.c13
2 files changed, 8 insertions, 11 deletions
diff --git a/usr.sbin/iscsid/connection.c b/usr.sbin/iscsid/connection.c
index b8555a23a3c..464b6ea0df0 100644
--- a/usr.sbin/iscsid/connection.c
+++ b/usr.sbin/iscsid/connection.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: connection.c,v 1.16 2014/04/20 20:12:31 claudio Exp $ */
+/* $OpenBSD: connection.c,v 1.17 2014/04/21 12:26:50 claudio Exp $ */
/*
* Copyright (c) 2009 Claudio Jeker <claudio@openbsd.org>
@@ -131,6 +131,10 @@ conn_dispatch(int fd, short event, void *arg)
return;
}
if ((n = pdu_read(c)) == -1) {
+ if (errno == EAGAIN || errno == ENOBUFS ||
+ errno == EINTR) /* try later */
+ return;
+ log_warn("pdu_read");
conn_fsm(c, CONN_EV_FAIL);
return;
}
diff --git a/usr.sbin/iscsid/pdu.c b/usr.sbin/iscsid/pdu.c
index 8167f662821..a73c19e2ccb 100644
--- a/usr.sbin/iscsid/pdu.c
+++ b/usr.sbin/iscsid/pdu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pdu.c,v 1.8 2014/04/20 18:17:12 claudio Exp $ */
+/* $OpenBSD: pdu.c,v 1.9 2014/04/21 12:26:50 claudio Exp $ */
/*
* Copyright (c) 2009 Claudio Jeker <claudio@openbsd.org>
@@ -246,15 +246,8 @@ pdu_read(struct connection *c)
}
}
- if ((n = readv(c->fd, iov, niov)) == -1) {
- if (errno == EAGAIN || errno == ENOBUFS ||
- errno == EINTR) /* try later */
- return 0;
- else {
- log_warn("pdu_read");
- return -1;
- }
- }
+ if ((n = readv(c->fd, iov, niov)) == -1)
+ return -1;
if (n == 0)
/* XXX what should we do on close with remaining data? */
return 0;