diff options
author | Richard Jones <rjones@redhat.com> | 2009-04-03 19:08:19 +0100 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2009-04-03 19:08:19 +0100 |
commit | d134143b55ecb5f7e6f74318acbf04f9e1370af6 (patch) | |
tree | dd12c32499204fc9967babb5b3207143e644e631 /src/guestfs.c | |
parent | 40ca9a57829f2e82362e391d7d998bf33c8bd671 (diff) | |
download | libguestfs-d134143b55ecb5f7e6f74318acbf04f9e1370af6.tar.gz libguestfs-d134143b55ecb5f7e6f74318acbf04f9e1370af6.tar.xz libguestfs-d134143b55ecb5f7e6f74318acbf04f9e1370af6.zip |
Makes a series of non-trivial calls.
Diffstat (limited to 'src/guestfs.c')
-rw-r--r-- | src/guestfs.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/guestfs.c b/src/guestfs.c index 309cd15b..6de631ff 100644 --- a/src/guestfs.c +++ b/src/guestfs.c @@ -170,6 +170,11 @@ guestfs_create (void) str = getenv ("LIBGUESTFS_DEBUG"); g->verbose = str != NULL && strcmp (str, "1") == 0; + /* Start with large serial numbers so they are easy to spot + * inside the protocol. + */ + g->msg_next_serial = 0x00123400; + return g; } @@ -862,13 +867,13 @@ sock_read_event (void *data, int watch, int fd, int events) goto cleanup; } - if (g->msg_in_size < len) return; /* Need more of this message. */ + if (g->msg_in_size-4 < len) return; /* Need more of this message. */ /* This should not happen, and if it does it probably means we've * lost all hope of synchronization. */ - if (g->msg_in_size > len) { - error (g, "len = %d, but msg_in_size = %d", len, g->msg_in_size); + if (g->msg_in_size-4 > len) { + error (g, "len = %d, but msg_in_size-4 = %d", len, g->msg_in_size-4); goto cleanup; } @@ -944,7 +949,7 @@ sock_write_event (void *data, int watch, int fd, int events) return; if (g->verbose) - fprintf (stderr, "sock_write_event: done writing, switching back to reading events\n", n); + fprintf (stderr, "sock_write_event: done writing, switching back to reading events\n"); free (g->msg_out); g->msg_out_pos = g->msg_out_size = 0; |