> -----Original Message-----
> From: Tomas Hozza [mailto:tho...@redhat.com]
> Sent: Thursday, June 27, 2013 7:53 AM
> To: gre...@linuxfoundation.org
> Cc: jasow...@redhat.com; de...@linuxdriverproject.org; KY Srinivasan; Haiyang
> Zhang; Tomas Hozza
> Subject: [PATCH 2/3] 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 <tho...@redhat.com>
Signed-off-by: K. Y. Srinivasan <k...@microsoft.com>
> ---
>  tools/hv/hv_vss_daemon.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/hv/hv_vss_daemon.c b/tools/hv/hv_vss_daemon.c
> index 64112e1..6c4d2f1 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.
>        */
> --
> 1.8.1.4
> 
> 


_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to