From: Tomas Hozza Date: Thu, 27 Jun 2013 11:52:48 +0000 (+0200) Subject: tools: hv: Check return value of setsockopt call X-Git-Tag: next-20130731~23^2~6 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=d12e14692448e9f256028f53926a9bd3c3091e11;p=karo-tx-linux.git 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 Signed-off-by: K. Y. Srinivasan Signed-off-by: Greg Kroah-Hartman --- 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) exit(EXIT_FAILURE); } 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. */