Skip to contentSkip to conversation

autofs-5.2.0 - fix build with non-glibc C libraries in lib/misc.c

PATCH New Khem Raj 1 participant 1 message Nov 13

Subsystems (2)
lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 autofs-5.2.0 - fix build with non-glibc C libraries in lib/misc.c

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.

---
 lib/misc.c | 5 +++++
 1 file changed, 5 insertions(+)
lib/misc.c +5 -0
index 453d713..7b285be 100644
@@ -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;