FIX: client should return negative value if unexpected message is received

Each time the client receives a message from the server it
compares the message received against the predefined template.
If those messages differ the client should exit with negative
value returned.

If tosend_elem is not NULL then the client was interrupted
by unexpected message from the server and negative value
must be returned.

Signed-off-by: Marat Stanichenko <mstanichenko@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>