summaryrefslogtreecommitdiff
path: root/src/fs_fsys.c
diff options
context:
space:
mode:
authorAriadne Conill <ariadne@dereferenced.org>2021-12-10 14:03:45 -0600
committerAriadne Conill <ariadne@dereferenced.org>2021-12-14 12:57:47 -0600
commit15971a7a6738abb18ed027f667b2cb15dc9c792d (patch)
treece2b52e67b3d3c73d0525aff2f36eeb5635d71b5 /src/fs_fsys.c
parent892a55635757e32bf48e7c40f3fc7443b6522db0 (diff)
downloadapk-tools-15971a7a6738abb18ed027f667b2cb15dc9c792d.tar.gz
apk-tools-15971a7a6738abb18ed027f667b2cb15dc9c792d.tar.bz2
apk-tools-15971a7a6738abb18ed027f667b2cb15dc9c792d.tar.xz
apk-tools-15971a7a6738abb18ed027f667b2cb15dc9c792d.zip
everywhere: only do xattr on linux, use fstatfs on non-linux instead of fstatfs64
Diffstat (limited to 'src/fs_fsys.c')
-rw-r--r--src/fs_fsys.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/fs_fsys.c b/src/fs_fsys.c
index 3dad4e0..142af18 100644
--- a/src/fs_fsys.c
+++ b/src/fs_fsys.c
@@ -97,7 +97,9 @@ static int fsys_file_extract(struct apk_ctx *ac, const struct apk_file_info *fi,
{
char tmpname_file[TMPNAME_MAX], tmpname_linktarget[TMPNAME_MAX];
struct apk_out *out = &ac->out;
+#ifdef __linux__
struct apk_xattr *xattr;
+#endif
int fd, r = -1, atflags = 0, ret = 0;
int atfd = apk_ctx_fd_dest(ac);
const char *fn = fi->name, *link_target = fi->link_target;
@@ -152,8 +154,12 @@ static int fsys_file_extract(struct apk_ctx *ac, const struct apk_file_info *fi,
case S_IFBLK:
case S_IFCHR:
case S_IFIFO:
+#ifdef __linux__
r = mknodat(atfd, fn, fi->mode, fi->device);
if (r < 0) ret = -errno;
+#else
+ ret = -ENOTSUP;
+#endif
break;
}
if (ret) {
@@ -185,12 +191,14 @@ static int fsys_file_extract(struct apk_ctx *ac, const struct apk_file_info *fi,
r = 0;
fd = openat(atfd, fn, O_RDWR);
if (fd >= 0) {
+#ifdef __linux__
foreach_array_item(xattr, fi->xattrs) {
if (fsetxattr(fd, xattr->name, xattr->value.ptr, xattr->value.len, 0) < 0) {
r = -errno;
if (r != -ENOTSUP) break;
}
}
+#endif
close(fd);
} else {
r = -errno;