Skip to content

Commit

Permalink
qtest: Fix FMT_timeval vs time_t
Browse files Browse the repository at this point in the history
Since FMT_timeval unconditionally uses %ld for both tv_sec and tv_usec,
and already casts tv_usec to long, also cast tv_sec to long.

Cc: Andreas Färber <[email protected]>
Reviewed-by: Aurelien Jarno <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
  • Loading branch information
rth7680 committed Sep 2, 2013
1 parent 01547f7 commit 35aa3fb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions qtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ static void qtest_send_prefix(CharDriverState *chr)

qtest_get_time(&tv);
fprintf(qtest_log_fp, "[S +" FMT_timeval "] ",
tv.tv_sec, (long) tv.tv_usec);
(long) tv.tv_sec, (long) tv.tv_usec);
}

static void GCC_FMT_ATTR(2, 3) qtest_send(CharDriverState *chr,
Expand Down Expand Up @@ -225,7 +225,7 @@ static void qtest_process_command(CharDriverState *chr, gchar **words)

qtest_get_time(&tv);
fprintf(qtest_log_fp, "[R +" FMT_timeval "]",
tv.tv_sec, (long) tv.tv_usec);
(long) tv.tv_sec, (long) tv.tv_usec);
for (i = 0; words[i]; i++) {
fprintf(qtest_log_fp, " %s", words[i]);
}
Expand Down Expand Up @@ -485,7 +485,7 @@ static void qtest_event(void *opaque, int event)
qtest_opened = true;
if (qtest_log_fp) {
fprintf(qtest_log_fp, "[I " FMT_timeval "] OPENED\n",
start_time.tv_sec, (long) start_time.tv_usec);
(long) start_time.tv_sec, (long) start_time.tv_usec);
}
break;
case CHR_EVENT_CLOSED:
Expand All @@ -494,7 +494,7 @@ static void qtest_event(void *opaque, int event)
qemu_timeval tv;
qtest_get_time(&tv);
fprintf(qtest_log_fp, "[I +" FMT_timeval "] CLOSED\n",
tv.tv_sec, (long) tv.tv_usec);
(long) tv.tv_sec, (long) tv.tv_usec);
}
break;
default:
Expand Down

0 comments on commit 35aa3fb

Please sign in to comment.