• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Alexander Dahl
  1. Alexander Dahl

buildroot

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Alexander Dahl
  2. buildroot

Source

buildroot/package/libiscsi/0004-examples-fix-uint64_t-formatting-issues.patch
Vicente Olivert RieraVicente Olivert Riera committed a1f4227d96a04 Nov 2014
Raw file
Source viewDiff to previous
xxxxxxxxxx
 
From fdfeff0462e17e0f0e37e65e5b6be6e74a9b39fd Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Tue, 2 Sep 2014 22:43:44 +0200
Subject: [PATCH 4/4] examples: fix uint64_t formatting issues
​
Using %lu to format uint64_t doesn't work for 32 bits architecture,
because uint64_t is an unsigned long long and therefore %llu should be
used. The solution is to use PRIu64 from <inttypes.h>, which is equal
to %lu on 64 bits architectures, and %llu on 32 bits architectures,
which corresponds to the definition of uint64_t.
​
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 examples/iscsi-dd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
​
diff --git a/examples/iscsi-dd.c b/examples/iscsi-dd.c
index 4cc7c2b..33007c3 100644
--- a/examples/iscsi-dd.c
+++ b/examples/iscsi-dd.c
@@ -19,6 +19,7 @@
 #include <stdlib.h>
 #include <stdint.h>
 #include <string.h>
+#include <inttypes.h>
 #include <poll.h>
 #include <getopt.h>
 #include "iscsi.h"
@@ -79,7 +80,7 @@ void write_cb(struct iscsi_context *iscsi, int status, void *command_data, void
    fill_read_queue(client);
 
    if (client->progress) {
-       printf("\r%lu of %lu blocks transferred.", client->pos, client->src_num_blocks);
+       printf("\r%" PRIu64 " of %" PRIu64 " blocks transferred.", client->pos, client->src_num_blocks);
    }
 
    if ((client->in_flight == 0) && (client->pos == client->src_num_blocks)) {
@@ -378,7 +379,7 @@ int main(int argc, char *argv[])
    }
 
    if (client.src_num_blocks > client.dst_num_blocks) {
-       fprintf(stderr, "source LUN is bigger than destination (%lu > %lu sectors)\n", client.src_num_blocks, client.dst_num_blocks);
+       fprintf(stderr, "source LUN is bigger than destination (%" PRIu64 " > %" PRIu64 " sectors)\n", client.src_num_blocks, client.dst_num_blocks);
        exit(10);
    }
 
-- 
2.0.0
​
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.7.2
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.