msc: Return an error if we close the fd
diff --git a/src/msc_conn.c b/src/msc_conn.c
index 66a1a0b..902546f 100644
--- a/src/msc_conn.c
+++ b/src/msc_conn.c
@@ -281,7 +281,7 @@
 	return -1;
 }
 
-static void setnonblocking(struct bsc_fd *fd)
+static int setnonblocking(struct bsc_fd *fd)
 {
 	int flags;
 
@@ -290,7 +290,7 @@
 		perror("fcntl get failed");
 		close(fd->fd);
 		fd->fd = -1;
-		return;
+		return -1;
 	}
 
 	flags |= O_NONBLOCK;
@@ -299,8 +299,10 @@
 		perror("fcntl get failed");
 		close(fd->fd);
 		fd->fd = -1;
-		return;
+		return -1;
 	}
+
+	return 0;
 }
 
 static int connect_to_msc(struct bsc_fd *fd, const char *ip, int port, int tos)
@@ -318,7 +320,8 @@
 	}
 
 	/* make it non blocking */
-	setnonblocking(fd);
+	if (setnonblocking(fd) != 0)
+		return -1;
 
 	memset(&sin, 0, sizeof(sin));
 	sin.sin_family = AF_INET;