Просмотр исходного кода

vqsim: Check write result

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
Jan Friesse 6 лет назад
Родитель
Сommit
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)
 {
 	struct vq_node *other_vqn;
+	ssize_t write_res;
 
 	/* Send it to everyone in that node's partition (including itself) */
 	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);
 	}
 }