summaryrefslogtreecommitdiff
path: root/net/openbgpd/files/patch-openbsd-compat_imsg-buffer.c
diff options
context:
space:
mode:
authorHiroki Sato <hrs@FreeBSD.org>2012-12-24 12:41:36 +0000
committerHiroki Sato <hrs@FreeBSD.org>2012-12-24 12:41:36 +0000
commita32e5104bf6844ba5ab021a4965e712db701a575 (patch)
tree0462fe8b3ffdc2915376fe6e637f13ffa3254444 /net/openbgpd/files/patch-openbsd-compat_imsg-buffer.c
parentAnyEvent::MessagePack is MessagePack stream serializer/deserializer (diff)
Update to 5.2.201201209.
Notes
Notes: svn path=/head/; revision=309456
Diffstat (limited to 'net/openbgpd/files/patch-openbsd-compat_imsg-buffer.c')
-rw-r--r--net/openbgpd/files/patch-openbsd-compat_imsg-buffer.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/net/openbgpd/files/patch-openbsd-compat_imsg-buffer.c b/net/openbgpd/files/patch-openbsd-compat_imsg-buffer.c
index 7d807d2259d9..3db0ec22abe8 100644
--- a/net/openbgpd/files/patch-openbsd-compat_imsg-buffer.c
+++ b/net/openbgpd/files/patch-openbsd-compat_imsg-buffer.c
@@ -3,8 +3,8 @@ Index: openbsd-compat/imsg-buffer.c
RCS file: openbsd-compat/imsg-buffer.c
diff -N openbsd-compat/imsg-buffer.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
-+++ openbsd-compat/imsg-buffer.c 2 Jul 2011 16:06:38 -0000 1.1
-@@ -0,0 +1,303 @@
++++ openbsd-compat/imsg-buffer.c 8 Dec 2012 20:17:59 -0000 1.2
+@@ -0,0 +1,305 @@
+/* $OpenBSD: imsg-buffer.c,v 1.1 2010/05/26 16:44:32 nicm Exp $ */
+
+/*
@@ -164,22 +164,23 @@ diff -N openbsd-compat/imsg-buffer.c
+ i++;
+ }
+
++again:
+ if ((n = writev(msgbuf->fd, iov, i)) == -1) {
-+ if (errno == EAGAIN || errno == ENOBUFS ||
-+ errno == EINTR) /* try later */
-+ return (0);
-+ else
-+ return (-1);
++ if (errno == EAGAIN || errno == EINTR)
++ goto again;
++ if (errno == ENOBUFS)
++ errno = EAGAIN;
++ return (-1);
+ }
+
+ if (n == 0) { /* connection closed */
+ errno = 0;
-+ return (-2);
++ return (0);
+ }
+
+ msgbuf_drain(msgbuf, n);
+
-+ return (0);
++ return (1);
+}
+
+void
@@ -263,17 +264,18 @@ diff -N openbsd-compat/imsg-buffer.c
+ *(int *)CMSG_DATA(cmsg) = buf->fd;
+ }
+
++again:
+ if ((n = sendmsg(msgbuf->fd, &msg, 0)) == -1) {
-+ if (errno == EAGAIN || errno == ENOBUFS ||
-+ errno == EINTR) /* try later */
-+ return (0);
-+ else
-+ return (-1);
++ if (errno == EAGAIN || errno == EINTR)
++ goto again;
++ if (errno == ENOBUFS)
++ errno = EAGAIN;
++ return (-1);
+ }
+
+ if (n == 0) { /* connection closed */
+ errno = 0;
-+ return (-2);
++ return (0);
+ }
+
+ /*
@@ -287,7 +289,7 @@ diff -N openbsd-compat/imsg-buffer.c
+
+ msgbuf_drain(msgbuf, n);
+
-+ return (0);
++ return (1);
+}
+
+void