diff options
author | Tomas Hozza <thozza@redhat.com> | 2013-05-22 08:54:30 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-03 17:13:09 -0400 |
commit | 359016032239e0a585c01bffe04b72ab037e5de4 (patch) | |
tree | 577dd2105e4f67e237e3f3ab58563d69d526890f /tools/hv/hv_kvp_daemon.c | |
parent | 98b80d8938b8e381027f1c3f30855087238fb4fb (diff) |
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: Tomas Hozza <thozza@redhat.com>
Acked-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools/hv/hv_kvp_daemon.c')
-rw-r--r-- | tools/hv/hv_kvp_daemon.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c index 5a1f6489d185..ae9aa1cd97fe 100644 --- a/tools/hv/hv_kvp_daemon.c +++ b/tools/hv/hv_kvp_daemon.c | |||
@@ -1457,7 +1457,13 @@ int main(void) | |||
1457 | exit(EXIT_FAILURE); | 1457 | exit(EXIT_FAILURE); |
1458 | } | 1458 | } |
1459 | nl_group = CN_KVP_IDX; | 1459 | nl_group = CN_KVP_IDX; |
1460 | setsockopt(fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, &nl_group, sizeof(nl_group)); | 1460 | |
1461 | if (setsockopt(fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, &nl_group, sizeof(nl_group)) < 0) { | ||
1462 | syslog(LOG_ERR, "setsockopt failed; error: %d %s", errno, strerror(errno)); | ||
1463 | close(fd); | ||
1464 | exit(EXIT_FAILURE); | ||
1465 | } | ||
1466 | |||
1461 | /* | 1467 | /* |
1462 | * Register ourselves with the kernel. | 1468 | * Register ourselves with the kernel. |
1463 | */ | 1469 | */ |