3a4504973c2da8eea72ff1a8a8f337cede4469b6
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / libiscsi / 0004-examples-fix-uint64_t-formatting-issues.patch
1 From fdfeff0462e17e0f0e37e65e5b6be6e74a9b39fd Mon Sep 17 00:00:00 2001
2 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 Date: Tue, 2 Sep 2014 22:43:44 +0200
4 Subject: [PATCH 4/4] examples: fix uint64_t formatting issues
5
6 Using %lu to format uint64_t doesn't work for 32 bits architecture,
7 because uint64_t is an unsigned long long and therefore %llu should be
8 used. The solution is to use PRIu64 from <inttypes.h>, which is equal
9 to %lu on 64 bits architectures, and %llu on 32 bits architectures,
10 which corresponds to the definition of uint64_t.
11
12 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
13 ---
14  examples/iscsi-dd.c | 5 +++--
15  1 file changed, 3 insertions(+), 2 deletions(-)
16
17 diff --git a/examples/iscsi-dd.c b/examples/iscsi-dd.c
18 index 4cc7c2b..33007c3 100644
19 --- a/examples/iscsi-dd.c
20 +++ b/examples/iscsi-dd.c
21 @@ -19,6 +19,7 @@
22  #include <stdlib.h>
23  #include <stdint.h>
24  #include <string.h>
25 +#include <inttypes.h>
26  #include <poll.h>
27  #include <getopt.h>
28  #include "iscsi.h"
29 @@ -79,7 +80,7 @@ void write_cb(struct iscsi_context *iscsi, int status, void *command_data, void
30         fill_read_queue(client);
31  
32         if (client->progress) {
33 -               printf("\r%lu of %lu blocks transferred.", client->pos, client->src_num_blocks);
34 +               printf("\r%" PRIu64 " of %" PRIu64 " blocks transferred.", client->pos, client->src_num_blocks);
35         }
36  
37         if ((client->in_flight == 0) && (client->pos == client->src_num_blocks)) {
38 @@ -378,7 +379,7 @@ int main(int argc, char *argv[])
39         }
40  
41         if (client.src_num_blocks > client.dst_num_blocks) {
42 -               fprintf(stderr, "source LUN is bigger than destination (%lu > %lu sectors)\n", client.src_num_blocks, client.dst_num_blocks);
43 +               fprintf(stderr, "source LUN is bigger than destination (%" PRIu64 " > %" PRIu64 " sectors)\n", client.src_num_blocks, client.dst_num_blocks);
44                 exit(10);
45         }
46  
47 -- 
48 2.0.0
49