autofs: Fix build with musl

lib/misc.c in 5.2.0 uses the GNU strerror_r() but, unlike the rest of
autofs, does not include automount.h, which maps it to
autofs_strerror_r() for non-glibc C libraries. Do the same mapping in
misc.c.

AI-Generated: Uses Claude Code
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
Khem Raj committed 2026-11-12 20:54:49 -08:00
1 parent f140d66e8b
commit 9aaca244d5
2 files changed
+35

No files matched your search

@@ -0,0 +1,34 @@
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 12 Nov 2026 00:00:00 -0800
Subject: [PATCH] misc: Use autofs_strerror_r() with non-glibc C libraries
The open/close on exec functions moved to lib/misc.c expect the GNU
strerror_r() that returns a char pointer. Unlike the rest of autofs,
misc.c does not include automount.h, which maps strerror_r() to
autofs_strerror_r() when not building with glibc, so the build fails with
musl:
misc.c:96:8: error: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
Do the same mapping in misc.c.
Upstream-Status: Submitted [https://lore.kernel.org/autofs/20261113043743.2721837-1-raj.khem@gmail.com/]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
lib/misc.c | 5 +++++
1 file changed, 5 insertions(+)
--- a/lib/misc.c
+++ b/lib/misc.c
@@ -30,6 +30,11 @@
#include "log.h"
#include "misc.h"
+#ifndef __GLIBC__
+# define strerror_r(N,B,S) autofs_strerror_r(N,B,S)
+char *autofs_strerror_r(int errnum, char *buf, size_t buflen); /* GNU */
+#endif
+
#define MAX_ERR_BUF 128
static pthread_mutex_t open_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -19,6 +19,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/daemons/autofs/v5/autofs-${PV}.tar.gz \
file://0007-Avoid-conflicts-between-sys-mount.h-and-linux-mount..patch \
file://0008-include-libgen.h-for-basename.patch \
file://0009-hash.h-include-sys-reg.h-instead-of-bits-reg.h.patch \
file://0010-misc-Use-autofs_strerror_r-with-non-glibc-C-librarie.patch \
"
SRC_URI[sha256sum] = "966bcacb571a7000a4d2afda0db5f7af84e4ef2444f04d7fc17898f1d2409c6b"