diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2011-03-18 11:21:55 +0000 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2011-03-18 11:21:55 +0000 |
commit | 1e68f84c5a46f3ff650368a897bd4113bd3f4aea (patch) | |
tree | 502897efd9b496ab0f8a666cd431b5fed1d82794 /daemon/proto.c | |
parent | 65852011d8f5150c5c0bcbfeac90e2fd784905c5 (diff) | |
download | libguestfs-1e68f84c5a46f3ff650368a897bd4113bd3f4aea.tar.gz libguestfs-1e68f84c5a46f3ff650368a897bd4113bd3f4aea.tar.xz libguestfs-1e68f84c5a46f3ff650368a897bd4113bd3f4aea.zip |
daemon: Print error for invalid chunk.cancel field.
The chunk.cancel field should always be [0|1]. If it is not then
something has gone badly wrong -- probably loss of synchronization.
If this occurs print a debug message and return error from
receive_file function.
Diffstat (limited to 'daemon/proto.c')
-rw-r--r-- | daemon/proto.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/daemon/proto.c b/daemon/proto.c index 90a83886..cef11463 100644 --- a/daemon/proto.c +++ b/daemon/proto.c @@ -405,6 +405,13 @@ receive_file (receive_cb cb, void *opaque) "receive_file: got chunk: cancel = 0x%x, len = %d, buf = %p\n", chunk.cancel, chunk.data.data_len, chunk.data.data_val); + if (chunk.cancel != 0 && chunk.cancel != 1) { + fprintf (stderr, + "receive_file: chunk.cancel != [0|1] ... " + "continuing even though we have probably lost synchronization with the library\n"); + return -1; + } + if (chunk.cancel) { if (verbose) fprintf (stderr, "receive_file: received cancellation from library\n"); |