Skip to contentSkip to conversation

getcifsacl, setcifsacl: add missing <linux/limits.h> include for XATTR_SIZE_MAX

PATCH In review Sam James 2 participants 3 messages Aug 16, 2022 – Mar 26, 2024

Subsystems (2)
lore
Share & tools
lore

Sam James

author
#0 lore raw

PATCH 1/2 getcifsacl, setcifsacl: add missing <linux/limits.h> include for XATTR_SIZE_MAX

Needed to build on musl. It only works on glibc because of transitive includes (which could break in future).

Example failure:

```
getcifsacl.c: In function 'getcifsacl':
getcifsacl.c:429:24: error: 'XATTR_SIZE_MAX' undeclared (first use in this function)
  429 |         if (bufsize >= XATTR_SIZE_MAX) {
      |                        ^~~~~~~~~~~~~~
```
---
 getcifsacl.c | 1 +
 setcifsacl.c | 1 +
 2 files changed, 2 insertions(+)
getcifsacl.c +1 -0
index 1c01062..d69d40a 100644
@@ -34,6 +34,7 @@
 #include <errno.h>
 #include <limits.h>
 #include <ctype.h>
+#include <linux/limits.h>
 #include <sys/xattr.h>
 #include "cifsacl.h"
 #include "idmap_plugin.h"
setcifsacl.c +1 -0
index d832cec..b7079ab 100644
@@ -48,6 +48,7 @@
 #include <errno.h>
 #include <limits.h>
 #include <ctype.h>
+#include <linux/limits.h>
 #include <sys/xattr.h>
 
 #include "cifsacl.h"
Signature · 1 line
2.37.2
author
#1 lore raw

PATCH 2/2 getcifsacl, setcifsacl: add missing <endian.h> include for le32toh

Needed to fix build on musl libc. It only works by chance on glibc because of transitive includes (which could break at any time).

Example failure:

```
getcifsacl.c: In function 'print_ace':
getcifsacl.c:284:16: warning: implicit declaration of function 'le16toh' [-Wimplicit-function-declaration]
  284 |         size = le16toh(pace->size);
      |                ^~~~~~~
```
---
 getcifsacl.c | 1 +
 setcifsacl.c | 1 +
 2 files changed, 2 insertions(+)
getcifsacl.c +1 -0
index d69d40a..123d11e 100644
@@ -23,6 +23,7 @@
 #include "config.h"
 #endif /* HAVE_CONFIG_H */
 
+#include <endian.h>
 #include <string.h>
 #include <getopt.h>
 #include <stdint.h>
setcifsacl.c +1 -0
index b7079ab..0bdc176 100644
@@ -38,6 +38,7 @@
 #include "config.h"
 #endif /* HAVE_CONFIG_H */
 
+#include <endian.h>
 #include <string.h>
 #include <getopt.h>
 #include <stdint.h>
Signature · 1 line
2.37.2
#2 lore raw
In reply to Sam James

Merged #1 and #2 into next. Thanks. Sorry, I missed these patches previously.

Best regards,
Pavel Shilovsky

пн, 15 авг. 2022 г. в 17:43, Sam James <[email protected]>:

Quoted 46 lines

Needed to build on musl. It only works on glibc because of transitive includes (which could break in future).

Example failure:

```
getcifsacl.c: In function 'getcifsacl':
getcifsacl.c:429:24: error: 'XATTR_SIZE_MAX' undeclared (first use in this function)
  429 |         if (bufsize >= XATTR_SIZE_MAX) {
      |                        ^~~~~~~~~~~~~~
```
---
 getcifsacl.c | 1 +
 setcifsacl.c | 1 +
 2 files changed, 2 insertions(+)
getcifsacl.c +1 -0
index 1c01062..d69d40a 100644
@@ -34,6 +34,7 @@
 #include <errno.h>
 #include <limits.h>
 #include <ctype.h>
+#include <linux/limits.h>
 #include <sys/xattr.h>
 #include "cifsacl.h"
 #include "idmap_plugin.h"
setcifsacl.c +1 -1
index d832cec..b7079ab 100644
@@ -48,6 +48,7 @@
 #include <errno.h>
 #include <limits.h>
 #include <ctype.h>
+#include <linux/limits.h>
 #include <sys/xattr.h>
 
 #include "cifsacl.h"
--

2.37.2