Skip to contentSkip to conversation

support/include/junction.h: Define macros for musl

PATCH In review [email protected] 2 participants 3 messages Sep 8, 2024 – Sep 20, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 support/include/junction.h: Define macros for musl

From: Robert Yang <[email protected]>

Fixed 1:
In file included from cache.c:1217:
../../support/include/junction.h:128:21: error: expected ';' before 'char'

  128 | __attribute_malloc__
      |                     ^
      |                     ;
  129 | char            **nfs_dup_string_array(char **array);

Fixed 2:
junction.c: In function 'junction_set_sticky_bit':
junction.c:164:39: error: 'ALLPERMS' undeclared (first use in this function)
164 | stb.st_mode &= (unsigned int)~ALLPERMS;

---
 support/include/junction.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
support/include/junction.h +10 -0
index 7257d80b..d127dd55 100644
@@ -26,6 +26,16 @@
 #ifndef _NFS_JUNCTION_H_
 #define _NFS_JUNCTION_H_
 
+/* For musl, refered to glibc's sys/cdefs.h */
+#ifndef __attribute_malloc__
+#define __attribute_malloc__ __attribute__((__malloc__))
+#endif
+
+/* For musl, refered to glibc's sys/stat.h */
+#ifndef ALLPERMS
+#define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)/* 07777 */
+#endif
+
 #include <stdint.h>
 
 /*
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/2 support/junction/path.c: Fix buld for musl

From: Robert Yang <[email protected]>

Fixed:
path.c:164:24: error: implicit declaration of function 'strchrnul'; did you mean 'strchr'? [-Wimplicit-function-declaration] [snip]

path.c:239:27: error: 'NAME_MAX' undeclared (first use in this function); did you mean 'AF_MAX'?

---
 support/junction/path.c | 6 ++++++
 1 file changed, 6 insertions(+)
support/junction/path.c +6 -0
index 13a14386..dd0f59a0 100644
@@ -23,6 +23,12 @@
  *	http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
  */
 
+/* For musl */
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#include <limits.h>
+
 #include <sys/types.h>
 #include <sys/stat.h>
 
Signature · 1 line
2.25.1
#2 lore raw
In reply to [email protected]
Quoted 10 lines · On 9/8/24 8:12 AM, [email protected] wrote:

From: Robert Yang <[email protected]>

Fixed 1:
In file included from cache.c:1217:
../../support/include/junction.h:128:21: error: expected ';' before 'char'

   128 | __attribute_malloc__
       |                     ^
       |                     ;
   129 | char            **nfs_dup_string_array(char **array);
Quoted 6 lines

Fixed 2:
junction.c: In function 'junction_set_sticky_bit':
junction.c:164:39: error: 'ALLPERMS' undeclared (first use in this function)
164 | stb.st_mode &= (unsigned int)~ALLPERMS;

Both committed... (tag: nfs-utils-2-7-2-rc1)

steved.

Quoted 25 lines
---
  support/include/junction.h | 10 ++++++++++
  1 file changed, 10 insertions(+)
support/include/junction.h +10 -0
index 7257d80b..d127dd55 100644
@@ -26,6 +26,16 @@
  #ifndef _NFS_JUNCTION_H_
  #define _NFS_JUNCTION_H_
 
+/* For musl, refered to glibc's sys/cdefs.h */
+#ifndef __attribute_malloc__
+#define __attribute_malloc__ __attribute__((__malloc__))
+#endif
+
+/* For musl, refered to glibc's sys/stat.h */
+#ifndef ALLPERMS
+#define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)/* 07777 */
+#endif
+
  #include <stdint.h>
 
  /*