[libvirt] [PATCH] storage: Fix build on i686

Jiri Denemark posted 1 patch 7 years ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/efb446e1b0ee51671063089c6988a7977098a800.1490698500.git.jdenemar@redhat.com
src/storage/storage_backend_logical.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[libvirt] [PATCH] storage: Fix build on i686
Posted by Jiri Denemark 7 years ago
off_t is signed and it's size is the same as long only on 64b archs.
Thus it cannot be formatted as %lu.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/storage/storage_backend_logical.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
index 9ca6fd43b..d87aaf0b6 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -116,9 +116,9 @@ virStorageBackendLogicalInitializeDevice(const char *path)
 
     if (size < 4 * PV_BLANK_SECTOR_SIZE) {
         virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
-                       _("cannot initialize '%s' detected size='%lu' less "
+                       _("cannot initialize '%s' detected size='%zd' less "
                          "than minimum required='%d"),
-                         path, size, 4 * PV_BLANK_SECTOR_SIZE);
+                         path, (ssize_t) size, 4 * PV_BLANK_SECTOR_SIZE);
         goto cleanup;
     }
     if ((size = lseek(fd, 0, SEEK_SET)) == (off_t)-1) {
-- 
2.12.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] storage: Fix build on i686
Posted by Michal Privoznik 7 years ago
On 03/28/2017 12:55 PM, Jiri Denemark wrote:
> off_t is signed and it's size is the same as long only on 64b archs.
> Thus it cannot be formatted as %lu.
>
> Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
> ---
>  src/storage/storage_backend_logical.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
> index 9ca6fd43b..d87aaf0b6 100644
> --- a/src/storage/storage_backend_logical.c
> +++ b/src/storage/storage_backend_logical.c
> @@ -116,9 +116,9 @@ virStorageBackendLogicalInitializeDevice(const char *path)
>
>      if (size < 4 * PV_BLANK_SECTOR_SIZE) {
>          virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
> -                       _("cannot initialize '%s' detected size='%lu' less "
> +                       _("cannot initialize '%s' detected size='%zd' less "
>                           "than minimum required='%d"),
> -                         path, size, 4 * PV_BLANK_SECTOR_SIZE);
> +                         path, (ssize_t) size, 4 * PV_BLANK_SECTOR_SIZE);
>          goto cleanup;
>      }
>      if ((size = lseek(fd, 0, SEEK_SET)) == (off_t)-1) {
>

ACK

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list