[Libguestfs] [PATCH] daemon: ntfs: fix format strings

Pino Toscano ptoscano at redhat.com
Wed Mar 2 10:05:18 UTC 2016


Use PRIi64 as format string for int64_t, so it builds and works fine
also on 32bit.  Also switch from asprintf_nowarn to asprintf, since no
custom formats (eg %Q, %R) are used.
---
 daemon/ntfs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/daemon/ntfs.c b/daemon/ntfs.c
index 92088f7..e555c63 100644
--- a/daemon/ntfs.c
+++ b/daemon/ntfs.c
@@ -282,8 +282,8 @@ do_ntfscat_i (const mountable_t *mountable, int64_t inode)
   }
 
   /* Construct the command. */
-  if (asprintf_nowarn (&cmd, "ntfscat -i %ld %s",
-                       inode, mountable->device) == -1) {
+  if (asprintf (&cmd, "ntfscat -i %" PRIi64 " %s",
+                inode, mountable->device) == -1) {
     reply_with_perror ("asprintf");
     return -1;
   }
@@ -311,14 +311,14 @@ do_ntfscat_i (const mountable_t *mountable, int64_t inode)
   }
 
   if (ferror (fp)) {
-    fprintf (stderr, "fread: %ld: %m\n", inode);
+    fprintf (stderr, "fread: %" PRIi64 ": %m\n", inode);
     send_file_end (1);		/* Cancel. */
     pclose (fp);
     return -1;
   }
 
   if (pclose (fp) != 0) {
-    fprintf (stderr, "pclose: %ld: %m\n", inode);
+    fprintf (stderr, "pclose: %" PRIi64 ": %m\n", inode);
     send_file_end (1);		/* Cancel. */
     return -1;
   }
-- 
2.5.0




More information about the Libguestfs mailing list