summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2015-06-11 19:25:54 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2015-06-11 19:25:54 +0000
commit87270dfa6999538e02f264929babc57ac79dd320 (patch)
treee5c5b425ffb52bb6db4eb5d6462d2fcb41e86804 /lib
parent9913183e3fcec7e8e0d5443bc4858949dccb9783 (diff)
The correct semantic is to check msgbuf_write() for <= 0, not just < 0.
Fix one occurence in imsg_flush() and clarify it the man page. Discussed with at least blambert@ jsg@ yasuoka@. OK gilles@
Diffstat (limited to 'lib')
-rw-r--r--lib/libutil/imsg.c4
-rw-r--r--lib/libutil/imsg_init.314
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/libutil/imsg.c b/lib/libutil/imsg.c
index 4720cd5f6c3..0c1c782ec67 100644
--- a/lib/libutil/imsg.c
+++ b/lib/libutil/imsg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imsg.c,v 1.6 2014/06/30 00:26:22 deraadt Exp $ */
+/* $OpenBSD: imsg.c,v 1.7 2015/06/11 19:25:53 reyk Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -286,7 +286,7 @@ int
imsg_flush(struct imsgbuf *ibuf)
{
while (ibuf->w.queued)
- if (msgbuf_write(&ibuf->w) < 0)
+ if (msgbuf_write(&ibuf->w) <= 0)
return (-1);
return (0);
}
diff --git a/lib/libutil/imsg_init.3 b/lib/libutil/imsg_init.3
index 6c859b2ef52..45886c1ca5a 100644
--- a/lib/libutil/imsg_init.3
+++ b/lib/libutil/imsg_init.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: imsg_init.3,v 1.11 2013/12/26 17:32:33 eric Exp $
+.\" $OpenBSD: imsg_init.3,v 1.12 2015/06/11 19:25:53 reyk Exp $
.\"
.\" Copyright (c) 2010 Nicholas Marriott <nicm@openbsd.org>
.\"
@@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: December 26 2013 $
+.Dd $Mdocdate: June 11 2015 $
.Dt IMSG_INIT 3
.Os
.Sh NAME
@@ -393,8 +393,8 @@ routine transmits as many pending buffers as possible from
.Fn msgbuf
using
.Xr writev 2 .
-It returns 1 if it succeeds, \-1 on error and 0 when an EOF condition on the
-socket is detected.
+It returns 1 if it succeeds, \-1 on error and 0 when no buffers were
+pending or an EOF condition on the socket is detected.
Temporary resource shortages are returned with errno
.Er EAGAIN
and require the application to retry again in the future.
@@ -424,8 +424,8 @@ routine calls
.Xr sendmsg 2
to transmit buffers queued in
.Fa msgbuf .
-It returns 1 if it succeeds, \-1 on error, and 0 when an EOF condition on the
-socket is detected.
+It returns 1 if it succeeds, \-1 on error, and 0 when the queue was empty
+or an EOF condition on the socket is detected.
Temporary resource shortages are returned with errno
.Er EAGAIN
and require the application to retry again in the future.
@@ -498,7 +498,7 @@ library is used to monitor the socket file descriptor.
When the socket is ready for writing, queued messages are transmitted with
.Fn msgbuf_write :
.Bd -literal -offset indent
- if (msgbuf_write(&ibuf-\*(Gtw) \*(Lt 0 && errno != EAGAIN) {
+ if (msgbuf_write(&ibuf-\*(Gtw) \*(Lt= 0 && errno != EAGAIN) {
/* handle write failure */
}
.Ed