aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Victorovich <yuri@FreeBSD.org>2021-05-06 05:47:17 +0000
committerYuri Victorovich <yuri@FreeBSD.org>2021-05-06 05:49:42 +0000
commit6d9bd7171b6b5b3c4d9360be35c46fc2b02f5fff (patch)
tree1f9f242f7cdb54b199cbd2f201bc3801c25a9252
parenta166ff33ea01261a50dd08c6e1a985311d5cadc2 (diff)
downloadports-6d9bd7171b6b5b3c4d9360be35c46fc2b02f5fff.tar.gz
ports-6d9bd7171b6b5b3c4d9360be35c46fc2b02f5fff.zip
misc/librepo: Fix missing symbol 'flistxattr'
flistxattr is a function from Linux's xattr API that isn't available on FreeBSD and is mapped to FreeBSD syscalls. flistxattr mapping was missing since some port update. Reported by: Rick Miller <vrwmiller@gmail.com>
-rw-r--r--misc/librepo/Makefile1
-rw-r--r--misc/librepo/files/xattr.c21
-rw-r--r--misc/librepo/files/xattr.h1
3 files changed, 23 insertions, 0 deletions
diff --git a/misc/librepo/Makefile b/misc/librepo/Makefile
index a247554909b4..333c18cc44b9 100644
--- a/misc/librepo/Makefile
+++ b/misc/librepo/Makefile
@@ -1,5 +1,6 @@
PORTNAME= librepo
DISTVERSION= 1.14.0
+PORTREVISION= 1
CATEGORIES= misc
MAINTAINER= yuri@FreeBSD.org
diff --git a/misc/librepo/files/xattr.c b/misc/librepo/files/xattr.c
index b89e82cf3df0..34ae5fce5ef6 100644
--- a/misc/librepo/files/xattr.c
+++ b/misc/librepo/files/xattr.c
@@ -10,6 +10,16 @@
// code below is adopted and simplified from the 'xattr' python module https://github.com/xattr/xattr/blob/master/xattr/lib_build.c
+static void convert_bsd_list(char *namebuf, size_t size) {
+ size_t offset = 0;
+ while(offset < size) {
+ int length = (int) (unsigned char)namebuf[offset];
+ memmove(namebuf+offset, namebuf+offset+1, length);
+ namebuf[offset+length] = '\0';
+ offset += length+1;
+ }
+}
+
int fsetxattr(int fd, const char *name, const void *value, size_t size, int flags) {
int rv = 0;
@@ -24,6 +34,17 @@ int fsetxattr(int fd, const char *name, const void *value, size_t size, int flag
return rv;
}
+ssize_t flistxattr(int fd, char *namebuf, size_t size) {
+ ssize_t rv = 0;
+
+ rv = extattr_list_fd(fd, EXTATTR_NAMESPACE_USER, namebuf, size);
+
+ if (rv > 0 && namebuf)
+ convert_bsd_list(namebuf, rv);
+
+ return rv;
+}
+
ssize_t fgetxattr(int fd, const char *name, void *value, size_t size) {
return extattr_get_fd(fd, EXTATTR_NAMESPACE_USER, name, value, size);
}
diff --git a/misc/librepo/files/xattr.h b/misc/librepo/files/xattr.h
index 633417b953b3..8304b9a9660e 100644
--- a/misc/librepo/files/xattr.h
+++ b/misc/librepo/files/xattr.h
@@ -1,4 +1,5 @@
int fsetxattr(int fd, const char *name, const void *value, size_t size, int flags);
+ssize_t flistxattr(int fd, char *namebuf, size_t size);
ssize_t fgetxattr(int fd, const char *name, void *value, size_t size);
int fremovexattr(int fd, const char *name);