If we let descriptors equal 0, we can end up closing STDIN. Make sure
they start out as -1.
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
int flags;
/* Prepare device struct */
+ priv->local_bind_sd = -1;
priv->device = malloc(sizeof(struct sockaddr_ll));
if (priv->device == NULL)
return -ENOMEM;
int one = 1;
/* Prepare device struct */
+ priv->local_bind_sd = -1;
+ priv->local_bind_udp_port = 0;
priv->device = malloc(sizeof(struct sockaddr_in));
if (priv->device == NULL)
return -ENOMEM;
strerror(errno));
return -errno;
}
- priv->local_bind_sd = -1;
- priv->local_bind_udp_port = 0;
return 0;
}