Commit 294b911f authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Make netlink sockets non-blocking.

parent 0d3f0f18
...@@ -121,12 +121,19 @@ netlink_socket(struct netlink *nl, uint32_t groups) ...@@ -121,12 +121,19 @@ netlink_socket(struct netlink *nl, uint32_t groups)
nl->seqno = time(NULL); nl->seqno = time(NULL);
rc = fcntl(nl->sock, F_GETFL, 0);
if(rc < 0)
goto fail;
rc = fcntl(nl->sock, F_SETFL, (rc | O_NONBLOCK));
if(rc < 0)
goto fail;
rc = bind(nl->sock, (struct sockaddr *)&nl->sockaddr, nl->socklen); rc = bind(nl->sock, (struct sockaddr *)&nl->sockaddr, nl->socklen);
if(rc < 0) if(rc < 0)
goto fail; goto fail;
rc = getsockname(nl->sock, (struct sockaddr *)&nl->sockaddr, &nl->socklen); rc = getsockname(nl->sock, (struct sockaddr *)&nl->sockaddr, &nl->socklen);
if(rc < 0) if(rc < 0)
goto fail; goto fail;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment