Skip to content

Commit 7e1a1f2

Browse files
authored
qc-image-unpacker: add a fix for strrchr() conformance to C23 (#1757)
Building qc-image-unpacker using glibc 2.43 fails due to ISO C23 changes to strrchr(). Add a .patch to update code to use correct pointer types.
2 parents 9a79c16 + 17c194a commit 7e1a1f2

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
From 00eebb468fdf573c9c6a1bf88765e6dcb4165afb Mon Sep 17 00:00:00 2001
2+
From: Viswanath Kraleti <viswanath.kraleti@oss.qualcomm.com>
3+
Date: Fri, 13 Mar 2026 22:59:07 +0530
4+
Subject: [PATCH] utils: fix strrchr() conformance to C23
5+
6+
ISO C23 specifies search functions such as strrchr() as generic,
7+
returning a const pointer when the input argument is const.
8+
Assigning this return value to a non-const pointer results in build
9+
errors with glibc 2.43 and above versions.
10+
11+
Update utils_fileBasename() to use a const pointer for the strrchr()
12+
return value, restoring C23 conformance and fixing build issues.
13+
14+
Signed-off-by: Viswanath Kraleti <viswanath.kraleti@oss.qualcomm.com>
15+
Upstream-Status: Pending
16+
---
17+
src/utils.c | 2 +-
18+
1 file changed, 1 insertion(+), 1 deletion(-)
19+
20+
diff --git a/src/utils.c b/src/utils.c
21+
index 414679b..e22ec94 100644
22+
--- a/src/utils.c
23+
+++ b/src/utils.c
24+
@@ -216,7 +216,7 @@ void *utils_crealloc(void *ptr, size_t old_sz, size_t new_sz) {
25+
}
26+
27+
char *utils_fileBasename(char const *path) {
28+
- char *s = strrchr(path, '/');
29+
+ const char *s = strrchr(path, '/');
30+
if (!s) {
31+
return strdup(path);
32+
} else {

recipes-devtools/qc-image-unpacker/qc-image-unpacker_git.bb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ LIC_FILES_CHKSUM = "file://../LICENSE;md5=138532bb21858341808df2740a1d13bf"
88
SRC_URI = " \
99
git://github.com/anestisb/qc_image_unpacker;protocol=https;branch=master\
1010
file://0004-Fail-if-an-image-can-not-be-opened.patch;patchdir=.. \
11+
file://0001-utils-fix-strrchr-conformance-to-C23.patch;patchdir=.. \
1112
"
1213

1314
SRCREV = "28a783a9fc25dc87b7416b6d5b6f9ccd497d1c2e"

0 commit comments

Comments
 (0)