From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH] tools/libxc: Annotate xc_report_error with __attribute__((format)) Date: Thu, 5 Jun 2014 14:58:18 +0100 Message-ID: <5390777A.5090402@citrix.com> References: <1401817530-1296-1-git-send-email-andrew.cooper3@citrix.com> <1401973910.15729.74.camel@hastur.hellion.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1401973910.15729.74.camel@hastur.hellion.org.uk> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: Ian Jackson , Xen-devel List-Id: xen-devel@lists.xenproject.org On 05/06/14 14:11, Ian Campbell wrote: > On Tue, 2014-06-03 at 18:45 +0100, Andrew Cooper wrote: >> diff --git a/tools/libxc/xc_domain_restore.c b/tools/libxc/xc_domain_restore.c >> index 89af1ad..d950639 100644 >> --- a/tools/libxc/xc_domain_restore.c >> +++ b/tools/libxc/xc_domain_restore.c >> @@ -102,7 +102,7 @@ static ssize_t rdexact(xc_interface *xch, struct restore_ctx *ctx, >> errno = 0; >> } >> if ( len <= 0 ) { >> - ERROR("%s failed (read rc: %d, errno: %d)", __func__, len, errno); >> + ERROR("%s failed (read rc: %ld, errno: %d)", __func__, (long)len, errno); > The correct way to print an ssize_t is %zd. Odd - I thought I tried that and it failed, but clearly I failed to try it correctly. > >> return -1; >> } >> offset += len; >> @@ -443,7 +443,7 @@ static int compat_buffer_qemu(xc_interface *xch, struct restore_ctx *ctx, >> } >> >> if ( memcmp(qbuf, "QEVM", 4) ) { >> - ERROR("Invalid QEMU magic: 0x%08x", *(unsigned long*)qbuf); >> + ERROR("Invalid QEMU magic: 0x%08x", *(uint32_t*)qbuf); > 0x%08lx with unsigned long or 0x%PRIx32 with uint32_t, not some hybrid, > please. (I thin %..lx is the right answer here) qbuf is strictly 4 bytes, as identified in the line above. PRIx32 it is. (I remember deciding on PRIx32 and clearly failed to implement it properly) v2 on its way. ~Andrew