提交 d12e1469 编写于 作者: T Tomas Hozza 提交者: Greg Kroah-Hartman

tools: hv: Check return value of setsockopt call

Check return value of setsockopt call and if it fails print error to the
system log and exit with non-zero value.
Signed-off-by: NTomas Hozza <thozza@redhat.com>
Signed-off-by: NK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 9561d479
...@@ -173,7 +173,11 @@ int main(void) ...@@ -173,7 +173,11 @@ int main(void)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
nl_group = CN_VSS_IDX; nl_group = CN_VSS_IDX;
setsockopt(fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, &nl_group, sizeof(nl_group)); if (setsockopt(fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, &nl_group, sizeof(nl_group)) < 0) {
syslog(LOG_ERR, "setsockopt failed; error:%d %s", errno, strerror(errno));
close(fd);
exit(EXIT_FAILURE);
}
/* /*
* Register ourselves with the kernel. * Register ourselves with the kernel.
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册