Skip to contentSkip to conversation

sg3-utils: Fix build with musl

PATCH New Khem Raj 1 participant 1 message Mar 12, 2023

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 sg3-utils: Fix build with musl

---
 ...01-sg_dd.c-Use-off_t-instead-of-uint.patch | 36 +++++++++++++++++++
 .../sg3-utils/sg3-utils_1.47.bb               |  2 +-
 2 files changed, 37 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-support/sg3-utils/sg3-utils/0001-sg_dd.c-Use-off_t-instead-of-uint.patch
meta-oe/recipes-support/sg3-utils/sg3-utils/0001-sg_dd.c-Use-off_t-instead-of-uint.patch new file +36 -0
new file mode 100644
index 0000000000..317876f197
@@ -0,0 +1,36 @@
+From 9a8ede03ef61cdf527ce3a80771150a7452e4603 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sat, 11 Mar 2023 22:56:17 -0800
+Subject: [PATCH] sg_dd.c: Use off_t instead of uint
+
+uint is not available on every platform e.g. linux/musl systems. Use
+uint32_t instead to represent 'off' variable, Fixes
+
+sg_dd.c:2402:17: error: use of undeclared identifier 'uint'; did you mean 'int'?
+                uint off;
+                ^~~~
+                int
+1 error generated.
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/sg_dd.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/sg_dd.c b/src/sg_dd.c
+index 9d05c93..35e2423 100644
+--- a/src/sg_dd.c
++++ b/src/sg_dd.c
+@@ -2399,7 +2399,7 @@ main(int argc, char * argv[])
+             res = blocks * blk_sz;
+             if (iflag.zero && iflag.ff && (blk_sz >= 4)) {
+                 uint32_t pos = (uint32_t)skip;
+-                uint off;
++                uint32_t off;
+ 
+                 for (k = 0, off = 0; k < blocks; ++k, off += blk_sz, ++pos) {
+                     for (j = 0; j < (blk_sz - 3); j += 4)
+-- 
+2.39.2
+
meta-oe/recipes-support/sg3-utils/sg3-utils_1.47.bb +1 -1
index fe129b8ed3..1aa65e6cc4 100644
@@ -9,7 +9,7 @@ LICENSE = "GPL-2.0-or-later & BSD-2-Clause"
 LIC_FILES_CHKSUM = "file://COPYING;md5=f685699d3ac82f108aa880043fa3feb7"
 
 SRC_URI = "http://sg.danny.cz/sg/p/sg3_utils-${PV}.tgz \
-"
+           file://0001-sg_dd.c-Use-off_t-instead-of-uint.patch"
 MIRRORS += "http://sg.danny.cz/sg/p https://fossies.org/linux/misc"
 
 UPSTREAM_CHECK_REGEX = "sg3_utils-(?P<pver>\d+(\.\d+)+)\.tgz"
Signature · 1 line
2.39.2