termux-packages/disabled-packages/apk-tools/src-io.c.patch

51 lines
1.1 KiB
Diff

diff -u -r ../apk-tools-2.10.1/src/io.c ./src/io.c
--- ../apk-tools-2.10.1/src/io.c 2018-09-10 08:04:03.000000000 +0000
+++ ./src/io.c 2018-09-10 21:56:03.349469566 +0000
@@ -1005,6 +1005,7 @@
.delete_item = (apk_hash_delete_f) free,
};
+#ifndef __ANDROID__
static struct cache_item *resolve_cache_item(struct apk_hash *hash, apk_blob_t name)
{
struct cache_item *ci;
@@ -1025,6 +1026,7 @@
return ci;
}
+#endif
void apk_id_cache_init(struct apk_id_cache *idc, int root_fd)
{
@@ -1049,6 +1051,9 @@
uid_t apk_resolve_uid(struct apk_id_cache *idc, const char *username, uid_t default_uid)
{
+#ifdef __ANDROID__
+ return getuid();
+#else
#ifdef HAVE_FGETPWENT_R
char buf[1024];
struct passwd pwent;
@@ -1088,10 +1093,14 @@
return ci->uid;
return default_uid;
+#endif
}
uid_t apk_resolve_gid(struct apk_id_cache *idc, const char *groupname, uid_t default_gid)
{
+#ifdef __ANDROID__
+ return getgid();
+#else
#ifdef HAVE_FGETGRENT_R
char buf[1024];
struct group grent;
@@ -1131,4 +1140,5 @@
return ci->gid;
return default_gid;
+#endif
}