On 10 November 2015 at 10:53, Peter Maydell <peter.mayd...@linaro.org> wrote:
> On 9 November 2015 at 22:36, Eric Blake <ebl...@redhat.com> wrote:
>> The only POSIX-ly correct portable way to print ssize_t is via casts
>> (yes, quite ugly), as in:
>>
>> printf("%zu", (size_t)(ssize_t_value));
>
> I'm running a test build using this approach.

The following fixup patch was sufficient to get the pull through
my tests.

Signed-off-by: Peter Maydell <peter.mayd...@linaro.org>

diff --git a/migration/migration.c b/migration/migration.c
index 58eb099..c5c977e 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1284,9 +1284,9 @@ static void *source_return_path_thread(void *opaque)
             header_len != rp_cmd_args[header_type].len) ||
             header_len > max_len) {
             error_report("RP: Received '%s' message (0x%04x) with"
-                    "incorrect length %d expecting %zd",
+                    "incorrect length %d expecting %zu",
                     rp_cmd_args[header_type].name, header_type, header_len,
-                    rp_cmd_args[header_type].len);
+                    (size_t)rp_cmd_args[header_type].len);
             mark_source_rp_bad(ms);
             goto out;
         }
diff --git a/migration/qemu-file-unix.c b/migration/qemu-file-unix.c
index 7ccdf69..c503b02 100644
--- a/migration/qemu-file-unix.c
+++ b/migration/qemu-file-unix.c
@@ -55,8 +55,8 @@ static ssize_t socket_writev_buffer(void *opaque,
struct iovec *iov, int iovcnt,
             err = socket_error();

             if (err != EAGAIN && err != EWOULDBLOCK) {
-                error_report("socket_writev_buffer: Got err=%d for (%zd/%zd)",
-                             err, size, len);
+                error_report("socket_writev_buffer: Got err=%d for (%zu/%zu)",
+                             err, (size_t)size, (size_t)len);
                 /*
                  * If I've already sent some but only just got the error, I
                  * could return the amount validly sent so far and wait for the
diff --git a/migration/savevm.c b/migration/savevm.c
index fad34b8..be52314 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1602,8 +1602,9 @@ static int loadvm_process_command(QEMUFile *f)
     }

     if (mig_cmd_args[cmd].len != -1 && mig_cmd_args[cmd].len != len) {
-        error_report("%s received with bad length - expecting %zd, got %d",
-                      mig_cmd_args[cmd].name, mig_cmd_args[cmd].len, len);
+        error_report("%s received with bad length - expecting %zu, got %d",
+                     mig_cmd_args[cmd].name,
+                     (size_t)mig_cmd_args[cmd].len, len);
         return -ERANGE;
     }

thanks
-- PMM

Reply via email to