diff options
author | Ariadne Conill <ariadne@dereferenced.org> | 2021-12-10 14:03:45 -0600 |
---|---|---|
committer | Ariadne Conill <ariadne@dereferenced.org> | 2021-12-14 12:57:47 -0600 |
commit | 15971a7a6738abb18ed027f667b2cb15dc9c792d (patch) | |
tree | ce2b52e67b3d3c73d0525aff2f36eeb5635d71b5 /src/fs_uvol.c | |
parent | 892a55635757e32bf48e7c40f3fc7443b6522db0 (diff) | |
download | apk-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_uvol.c')
-rw-r--r-- | src/fs_uvol.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/fs_uvol.c b/src/fs_uvol.c index ec6fc35..201861a 100644 --- a/src/fs_uvol.c +++ b/src/fs_uvol.c @@ -15,6 +15,11 @@ #include "apk_context.h" #include "apk_fs.h" +#ifdef __APPLE__ +# include <crt_externs.h> +# define environ (*_NSGetEnviron()) +#endif + static int uvol_run(struct apk_ctx *ac, char *action, const char *volname, char *arg1, char *arg2) { struct apk_out *out = &ac->out; @@ -49,7 +54,13 @@ static int uvol_extract(struct apk_ctx *ac, const char *volname, char *arg1, off char *argv[] = { (char*)apk_ctx_get_uvol(ac), "write", (char*) volname, arg1, 0 }; posix_spawn_file_actions_t act; +#ifdef __linux__ if (pipe2(pipefds, O_CLOEXEC) != 0) return -errno; +#else + if (pipe(pipefds) != 0) return -errno; + fcntl(pipefds[0], F_SETFL, O_CLOEXEC); + fcntl(pipefds[1], F_SETFL, O_CLOEXEC); +#endif posix_spawn_file_actions_init(&act); posix_spawn_file_actions_adddup2(&act, pipefds[0], STDIN_FILENO); |