changeset 4568:63aea27dd3bc draft

Linux: Care about the return of setsockopt
author Roy Marples <roy@marples.name>
date Tue, 23 Jul 2019 14:31:07 +0100
parents dda61c0a55f5
children 5de548eda5ae
files src/if-linux.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/if-linux.c	Tue Jul 23 14:26:53 2019 +0100
+++ b/src/if-linux.c	Tue Jul 23 14:31:07 2019 +0100
@@ -320,8 +320,9 @@
 	if (ctx->link_fd == -1)
 		return -1;
 #ifdef NETLINK_BROADCAST_ERROR
-	setsockopt(ctx->link_fd, SOL_NETLINK, NETLINK_BROADCAST_ERROR,
-	    &on, sizeof(on));
+	if (setsockopt(ctx->link_fd, SOL_NETLINK, NETLINK_BROADCAST_ERROR,
+	    &on, sizeof(on)) == -1)
+		return -1;
 #endif
 
 	if ((priv = calloc(1, sizeof(*priv))) == NULL)