aboutsummaryrefslogtreecommitdiffstats
path: root/main/util-linux/0001-hexdump-use-ll-format-modifier-instead-of-the-non-st.patch
blob: 8a0c24c126a2937e0b022308e0547915046cfe8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
From ef1ba1cd2af353f81afb57222ed26a30b116aa29 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Thu, 8 May 2014 13:22:00 +0000
Subject: [PATCH] hexdump: use 'll' format modifier instead of the non-standard
 'q'.

The printf(3) man page says about 'q':
("quad". 4.4BSD and Linux libc5 only. Don't use.) This is a synonym for ll.

This fixes hexdump with musl libc.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
 text-utils/hexdump-parse.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/text-utils/hexdump-parse.c b/text-utils/hexdump-parse.c
index 8d14c5b..9eb016d 100644
--- a/text-utils/hexdump-parse.c
+++ b/text-utils/hexdump-parse.c
@@ -226,7 +226,7 @@ void rewrite_rules(struct hexdump_fs *fs, struct hexdump *hex)
 	struct hexdump_fu *fu;
 	struct list_head *p, *q;
 	char *p1, *p2, *fmtp;
-	char savech, cs[3];
+	char savech, cs[4];
 	int nconv, prec = 0;
 
 	list_for_each (p, &fs->fulist) {
@@ -301,9 +301,10 @@ void rewrite_rules(struct hexdump_fs *fs, struct hexdump *hex)
 				goto isint;
 			} else if (first_letter(cs, "ouxX")) {
 				pr->flags = F_UINT;
-isint:				cs[2] = '\0';
-				cs[1] = cs[0];
-				cs[0] = 'q';
+isint:				cs[3] = '\0';
+				cs[2] = cs[0];
+				cs[1] = 'l';
+				cs[0] = 'l';
 				switch(fu->bcnt) {
 					case 0:
 						pr->bcnt = 4;
@@ -355,9 +356,10 @@ isint:				cs[2] = '\0';
 						pr->flags = F_ADDRESS;
 						++p2;
 						if (first_letter(p1 + 2, "dox")) {
-							cs[0] = 'q';
-							cs[1] = p1[2];
-							cs[2] = '\0';
+							cs[0] = 'l';
+							cs[1] = 'l';
+							cs[2] = p1[2];
+							cs[3] = '\0';
 						} else {
 							p1[3] = '\0';
 							badconv(p1);
-- 
2.1.2