mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
Fix various -Wformat problems.
Updating gnulib has caused -Wformat-signedness to be enabled. This has revealed many problems in C format strings. The fixes here fall into the following main categories: - Using %d with an unsigned parameter. - %x and %o expect an unsigned argument. - uid_t and gid_t are unsigned on Linux. The safe way to print these is to cast them to uintmax_t and then print them using the %ju modifier (see http://stackoverflow.com/a/1401581). - Using %d to print an enum. Since enums may be either char or int, I fixed this by casting the enum to int. - strtol_error & lzma_ret are both unsigned types.
This commit is contained in:
@@ -172,7 +172,7 @@ do_zero_device (const char *device)
|
||||
if (!is_zero (buf, sizeof buf)) {
|
||||
r = pwrite (fd, zero_buf, n, pos);
|
||||
if (r == -1) {
|
||||
reply_with_perror ("pwrite: %s (with %" PRId64 " bytes left to write)",
|
||||
reply_with_perror ("pwrite: %s (with %" PRIu64 " bytes left to write)",
|
||||
device, size);
|
||||
close (fd);
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user