Преглед изворни кода

vqsim: Check write result

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
Jan Friesse пре 6 година
родитељ
комит
e953cfeb87
1 измењених фајлова са 7 додато и 1 уклоњено
  1. 7 1
      vqsim/vqmain.c

+ 7 - 1
vqsim/vqmain.c

@@ -138,10 +138,16 @@ static void print_quorum_state(struct vq_node *node)
 static void propogate_vq_message(struct vq_node *vqn, const char *msg, int len)
 static void propogate_vq_message(struct vq_node *vqn, const char *msg, int len)
 {
 {
 	struct vq_node *other_vqn;
 	struct vq_node *other_vqn;
+	ssize_t write_res;
 
 
 	/* Send it to everyone in that node's partition (including itself) */
 	/* Send it to everyone in that node's partition (including itself) */
 	TAILQ_FOREACH(other_vqn, &vqn->partition->nodelist, entries) {
 	TAILQ_FOREACH(other_vqn, &vqn->partition->nodelist, entries) {
-		write(other_vqn->fd, msg, len);
+		write_res = write(other_vqn->fd, msg, len);
+		/*
+		 * Read counterpart is not ready for receiving non-complete message so
+		 * ensure all required information was send.
+		 */
+		assert(write_res == len);
 	}
 	}
 }
 }