Skip to content

Commit

Permalink
Use Linux functions on any OS based on GNU libc
Browse files Browse the repository at this point in the history
GNU libc (glibc) provides the prototypes for all the xattr functions.

Hence, extend the Linux support to anything based on GNU libc. In case
of failures, most likely the underlying xattr functions will need to
be fixed, rather than pyxattr itself.
  • Loading branch information
pinotree authored and iustin committed Sep 8, 2024
1 parent e0cfe36 commit 76f30b3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#define PY_SSIZE_T_CLEAN
#include <Python.h>
#if defined(__APPLE__) || defined(__linux__)
#if defined(__APPLE__) || defined(__linux__) || defined(__GLIBC__)
#include <sys/xattr.h>
#endif
#include <stdio.h>
Expand Down Expand Up @@ -224,7 +224,7 @@ static inline int _fremovexattr(int filedes, const char *name) {
return fremovexattr(filedes, name, 0);
}

#elif defined(__linux__)
#elif defined(__linux__) || defined(__GLIBC__)
#define _listxattr(path, list, size) listxattr(path, list, size)
#define _llistxattr(path, list, size) llistxattr(path, list, size)
#define _flistxattr(fd, list, size) flistxattr(fd, list, size)
Expand Down

0 comments on commit 76f30b3

Please sign in to comment.