aboutsummaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-daemons/autofs/autofs/0001-autofs-5.1.8-add-autofs_strerror_r-helper-for-musl.patch
blob: caf0105118fb49f300ff36e3d654287ab9f9c90a (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
From 88f991b0ebb6fb8fcaad3d0eb8fb51a7439d053e Mon Sep 17 00:00:00 2001
From: Fabian Groffen <grobian@gentoo.org>
Date: Wed, 2 Feb 2022 09:27:13 +0800
Subject: [PATCH 1/2] autofs-5.1.8 - add autofs_strerror_r() helper for musl

If using musl libc the XSI-compliant variant strerror_r() which returns
an integer instead of a pointer so add a helper function to handle this
case.

Signed-off-by: Fabian Groffen <grobian@gentoo.org>
Signed-off-by: Ian Kent <raven@themaw.net>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Upstream-Status: Pending

 include/automount.h |  5 +++++
 lib/log.c           | 10 ++++++++++
 2 files changed, 15 insertions(+)

diff --git a/include/automount.h b/include/automount.h
index 8cd8b3a..f759e59 100644
--- a/include/automount.h
+++ b/include/automount.h
@@ -51,6 +51,11 @@
 # endif
 #endif
 
+#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
+
 /* We MUST have the paths to mount(8) and umount(8) */
 #ifndef HAVE_MOUNT
 #error Failed to locate mount(8)!
diff --git a/lib/log.c b/lib/log.c
index 39b1e3b..b99fa39 100644
--- a/lib/log.c
+++ b/lib/log.c
@@ -368,3 +368,13 @@ pid_t log_pidinfo(struct autofs_point *ap, pid_t pid, char *label) {
 
 	return ppid;
 }
+
+#ifndef __GLIBC__
+# undef strerror_r
+char *autofs_strerror_r(int errnum, char *buf, size_t buflen) {
+	int s = strerror_r(errnum, buf, buflen);
+	if (s)
+		return NULL;
+	return buf;
+}
+#endif
-- 
2.37.3