diff options
author | Tomas Hozza <thozza@redhat.com> | 2013-06-27 07:52:48 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-26 19:40:41 -0400 |
commit | d12e14692448e9f256028f53926a9bd3c3091e11 (patch) | |
tree | c873f1b8c031c0f23f6ea93321c87bc4a4cbd77b /tools/hv | |
parent | 9561d479314f16b41563f73511fb61d91de4642f (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>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools/hv')
-rw-r--r-- | tools/hv/hv_vss_daemon.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/hv/hv_vss_daemon.c b/tools/hv/hv_vss_daemon.c index 5febe3542f79..826d499dc354 100644 --- a/tools/hv/hv_vss_daemon.c +++ b/tools/hv/hv_vss_daemon.c | |||
@@ -173,7 +173,11 @@ int main(void) | |||
173 | exit(EXIT_FAILURE); | 173 | exit(EXIT_FAILURE); |
174 | } | 174 | } |
175 | nl_group = CN_VSS_IDX; | 175 | nl_group = CN_VSS_IDX; |
176 | setsockopt(fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, &nl_group, sizeof(nl_group)); | 176 | if (setsockopt(fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, &nl_group, sizeof(nl_group)) < 0) { |
177 | syslog(LOG_ERR, "setsockopt failed; error:%d %s", errno, strerror(errno)); | ||
178 | close(fd); | ||
179 | exit(EXIT_FAILURE); | ||
180 | } | ||
177 | /* | 181 | /* |
178 | * Register ourselves with the kernel. | 182 | * Register ourselves with the kernel. |
179 | */ | 183 | */ |