git: 6d9bd7171b6b - main - misc/librepo: Fix missing symbol 'flistxattr'
Yuri Victorovich
yuri at FreeBSD.org
Thu May 6 05:49:49 UTC 2021
The branch main has been updated by yuri:
URL: https://cgit.FreeBSD.org/ports/commit/?id=6d9bd7171b6b5b3c4d9360be35c46fc2b02f5fff
commit 6d9bd7171b6b5b3c4d9360be35c46fc2b02f5fff
Author: Yuri Victorovich <yuri at FreeBSD.org>
AuthorDate: 2021-05-06 05:47:17 +0000
Commit: Yuri Victorovich <yuri at FreeBSD.org>
CommitDate: 2021-05-06 05:49:42 +0000
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 at gmail.com>
---
misc/librepo/Makefile | 1 +
misc/librepo/files/xattr.c | 21 +++++++++++++++++++++
misc/librepo/files/xattr.h | 1 +
3 files changed, 23 insertions(+)
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 at 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);
More information about the dev-commits-ports-all
mailing list