Don't dispatch 0 bytes.

This commit is contained in:
Roy Marples 2016-09-06 14:58:33 +00:00
parent 7ea9fe0f6a
commit 5c74cceb9b
2 changed files with 8 additions and 6 deletions

View File

@ -1530,15 +1530,16 @@ int
if_handlelink(struct dhcpcd_ctx *ctx)
{
struct msghdr msg;
ssize_t bytes;
ssize_t len;
memset(&msg, 0, sizeof(msg));
msg.msg_iov = ctx->iov;
msg.msg_iovlen = 1;
if ((bytes = recvmsg_realloc(ctx->link_fd, &msg, 0)) == -1)
if ((len = recvmsg_realloc(ctx->link_fd, &msg, 0)) == -1)
return -1;
if_dispatch(ctx, ctx->iov[0].iov_base);
if (len != 0)
if_dispatch(ctx, ctx->iov[0].iov_base);
return 0;
}

View File

@ -770,15 +770,16 @@ int
if_handlelink(struct dhcpcd_ctx *ctx)
{
struct msghdr msg;
ssize_t bytes;
ssize_t len;
memset(&msg, 0, sizeof(msg));
msg.msg_iov = ctx->iov;
msg.msg_iovlen = 1;
if ((bytes = recvmsg_realloc(ctx->link_fd, &msg, 0)) == -1)
if ((len = recvmsg_realloc(ctx->link_fd, &msg, 0)) == -1)
return -1;
if_dispatch(ctx, ctx->iov[0].iov_base);
if (len != 0)
if_dispatch(ctx, ctx->iov[0].iov_base);
return 0;
}