]> git.proxmox.com Git - qemu.git/commitdiff
virtio-9p: Use GCC_FMT_ATTR and fix a format warning
authorStefan Weil <weil@mail.berlios.de>
Mon, 27 Sep 2010 16:45:47 +0000 (18:45 +0200)
committerBlue Swirl <blauwirbel@gmail.com>
Sun, 3 Oct 2010 06:39:49 +0000 (06:39 +0000)
With the new gcc format warnings, gcc detected this:

/qemu/hw/virtio-9p.c:1040: error: format ‘%u’ expects type ‘unsigned int’, but argument 4 has type ‘__nlink_t’

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
hw/virtio-9p.c

index 32fa3bcc5c8b1d9e78db626e2836bca9ea5bad4c..3b2d49cde02c65d87920b92fc51964912653d832 100644 (file)
@@ -333,7 +333,8 @@ static int number_to_string(void *arg, char type)
     return ret;
 }
 
-static int v9fs_string_alloc_printf(char **strp, const char *fmt, va_list ap)
+static int GCC_FMT_ATTR(2, 0)
+v9fs_string_alloc_printf(char **strp, const char *fmt, va_list ap)
 {
     va_list ap2;
     char *iter = (char *)fmt;
@@ -387,7 +388,8 @@ alloc_print:
     return vsprintf(*strp, fmt, ap);
 }
 
-static void v9fs_string_sprintf(V9fsString *str, const char *fmt, ...)
+static void GCC_FMT_ATTR(2, 3)
+v9fs_string_sprintf(V9fsString *str, const char *fmt, ...)
 {
     va_list ap;
     int err;
@@ -1034,8 +1036,8 @@ static int stat_to_v9stat(V9fsState *s, V9fsString *name,
                 S_ISCHR(stbuf->st_mode) ? 'c' : 'b',
                 major(stbuf->st_rdev), minor(stbuf->st_rdev));
     } else if (S_ISDIR(stbuf->st_mode) || S_ISREG(stbuf->st_mode)) {
-        v9fs_string_sprintf(&v9stat->extension, "%s %u",
-                "HARDLINKCOUNT", stbuf->st_nlink);
+        v9fs_string_sprintf(&v9stat->extension, "%s %lu",
+                "HARDLINKCOUNT", (unsigned long)stbuf->st_nlink);
     }
 
     str = strrchr(name->data, '/');