[PATCH 12/39] libmultipath/uevent.c: handle errors from setsockopt()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Found by coverity.

Signed-off-by: Hannes Reinecke <hare@xxxxxxxx>
---
 libmultipath/uevent.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/libmultipath/uevent.c b/libmultipath/uevent.c
index fb8b4a7..ff4bc86 100644
--- a/libmultipath/uevent.c
+++ b/libmultipath/uevent.c
@@ -291,8 +291,12 @@ int failback_listen(void)
 		}
 
 		/* enable receiving of the sender credentials */
-		setsockopt(sock, SOL_SOCKET, SO_PASSCRED,
-			   &feature_on, sizeof(feature_on));
+		retval = setsockopt(sock, SOL_SOCKET, SO_PASSCRED,
+				    &feature_on, sizeof(feature_on));
+		if (retval < 0) {
+			condlog(0, "failed to enable credential passing, exit");
+			goto exit;
+		}
 
 	} else {
 		/* Fallback to read kernel netlink events */
@@ -330,8 +334,11 @@ int failback_listen(void)
 		condlog(3, "receive buffer size for socket is %u.", rcvsz);
 
 		/* enable receiving of the sender credentials */
-		setsockopt(sock, SOL_SOCKET, SO_PASSCRED,
-			   &feature_on, sizeof(feature_on));
+		if (setsockopt(sock, SOL_SOCKET, SO_PASSCRED,
+			       &feature_on, sizeof(feature_on)) < 0) {
+			condlog(0, "error on enabling credential passing for socket");
+			exit(1);
+		}
 
 		retval = bind(sock, (struct sockaddr *) &snl,
 			      sizeof(struct sockaddr_nl));
-- 
2.6.6

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel



[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux