diff options
| author | Roy Marples <roy@marples.name> | 2008-05-15 13:34:31 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2008-05-15 13:34:31 +0000 |
| commit | 57220ee0629f8c1ad3aad80aa43cf2b8878e1fbc (patch) | |
| tree | be6ca53e2a43ec71234d6a3158d913febc9ab053 /bpf.c | |
| parent | 0f1f396ae21a88beb53cc5c9dc37267ab3aa9108 (diff) | |
| download | dhcpcd-57220ee0629f8c1ad3aad80aa43cf2b8878e1fbc.tar.xz | |
get_packet 0 means no more buffer, so loops don't need to know the bpf/socket buffering.
Diffstat (limited to 'bpf.c')
| -rw-r--r-- | bpf.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -159,10 +159,11 @@ get_packet(struct interface *iface, void *data, ssize_t len) ssize_t bytes; const unsigned char *payload, *d; - if ((size_t)len > iface->buffer_size) { - errno = ENOBUFS; - return -1; + if (iface->buffer_pos > iface->buffer_len) { + iface->buffer_len = iface->buffer_pos = 0; + return 0; } + for (;;) { if (iface->buffer_len == 0) { bytes = read(iface->fd, iface->buffer, |
