Browse Source

remove buf_write(), not used in ntpd. found by theo

OPENBSD_3_7
henning 20 years ago
parent
commit
062c33dcbf
1 changed files with 1 additions and 27 deletions
  1. +1
    -27
      src/usr.sbin/ntpd/buffer.c

+ 1
- 27
src/usr.sbin/ntpd/buffer.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: buffer.c,v 1.3 2004/08/10 19:18:23 henning Exp $ */
/* $OpenBSD: buffer.c,v 1.4 2004/09/15 00:05:29 henning Exp $ */
/* /*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -28,7 +28,6 @@
#include "ntpd.h" #include "ntpd.h"
int buf_write(int, struct buf *);
void buf_enqueue(struct msgbuf *, struct buf *); void buf_enqueue(struct msgbuf *, struct buf *);
void buf_dequeue(struct msgbuf *, struct buf *); void buf_dequeue(struct msgbuf *, struct buf *);
@ -66,31 +65,6 @@ buf_close(struct msgbuf *msgbuf, struct buf *buf)
return (1); return (1);
} }
int
buf_write(int sock, struct buf *buf)
{
ssize_t n;
if ((n = write(sock, buf->buf + buf->rpos,
buf->size - buf->rpos)) == -1) {
if (errno == EAGAIN) /* cannot write immediately */
return (0);
else
return (-1);
}
if (n == 0) { /* connection closed */
errno = 0;
return (-2);
}
if (n < buf->size - buf->rpos) { /* not all data written yet */
buf->rpos += n;
return (0);
} else
return (1);
}
void void
buf_free(struct buf *buf) buf_free(struct buf *buf)
{ {


Loading…
Cancel
Save