Skip to content

Commit 91e901c

Browse files
mjbommarjmberg-intel
authored andcommitted
um: drivers: call kernel_strrchr() explicitly in cow_user.c
Building ARCH=um on glibc >= 2.43 fails: arch/um/drivers/cow_user.c: error: implicit declaration of function 'strrchr' [-Wimplicit-function-declaration] glibc 2.43's C23 const-preserving strrchr() macro does not survive UML's global -Dstrrchr=kernel_strrchr remap from arch/um/Makefile. Call kernel_strrchr() directly in cow_user.c so the source no longer depends on the -D rewrite. Fixes: 2c51a4b ("um: fix strrchr() problems") Suggested-by: Johannes Berg <[email protected]> Cc: [email protected] Assisted-by: Claude:claude-opus-4-6 Assisted-by: Codex:gpt-5-4 Signed-off-by: Michael Bommarito <[email protected]> Link: https://patch.msgid.link/[email protected] [remove unnecessary 'extern'] Signed-off-by: Johannes Berg <[email protected]>
1 parent 8aae2da commit 91e901c

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

arch/um/drivers/cow_user.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
#include "cow.h"
1616
#include "cow_sys.h"
1717

18+
/*
19+
* arch/um/Makefile remaps strrchr to kernel_strrchr; call the kernel
20+
* name directly to avoid glibc >= 2.43's C23 strrchr macro.
21+
*/
22+
char *kernel_strrchr(const char *, int);
23+
1824
#define PATH_LEN_V1 256
1925

2026
/* unsigned time_t works until year 2106 */
@@ -153,7 +159,7 @@ static int absolutize(char *to, int size, char *from)
153159
errno);
154160
return -1;
155161
}
156-
slash = strrchr(from, '/');
162+
slash = kernel_strrchr(from, '/');
157163
if (slash != NULL) {
158164
*slash = '\0';
159165
if (chdir(from)) {

0 commit comments

Comments
 (0)