From 631035342dcc8bc5b317b1283b7b0e12d867cda5 Mon Sep 17 00:00:00 2001 From: Jehan Date: Sat, 9 Jun 2018 01:15:18 +0200 Subject: [PATCH 1/3] gio: C_IN is defined in recent Android headers. C_IN macro was added years ago in bcbaf1bef0, using same value as the internal code of Android with the reasonning that "some parts of the API used by the resolver objects is not public in the Android NDK (yet)". Well since then things are changed, since it is definitely available (at least on the API 22 of Android which I am using) in the public header arpa/nameser_compat.h. Let's just add a #ifndef to handle both cases when you build with an older or recent API. --- gio/gthreadedresolver.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gio/gthreadedresolver.c b/gio/gthreadedresolver.c index e89dc156c..dad268c33 100644 --- a/gio/gthreadedresolver.c +++ b/gio/gthreadedresolver.c @@ -803,7 +803,9 @@ free_records (GList *records) #if defined(G_OS_UNIX) #ifdef __BIONIC__ +#ifndef C_IN #define C_IN 1 +#endif int res_query(const char *, int, int, u_char *, int); #endif #endif From f96417e470ff4241260d740f43884a178a5bce5a Mon Sep 17 00:00:00 2001 From: Jehan Date: Sat, 9 Jun 2018 01:24:08 +0200 Subject: [PATCH 2/3] gio: UNIX_PATH_MAX may be defined. On an Android build, API 22, at least, I got a: > warning: "UNIX_PATH_MAX" redefined We were currently defining it as: > #define UNIX_PATH_MAX sizeof (((struct sockaddr_un *) 0)->sun_path) Whereas Android's headers define this variable of sockaddr_un as: > char sun_path[UNIX_PATH_MAX]; So by definition, we will still get the right result in the end by just using the original value of UNIX_PATH_MAX. --- gio/gunixsocketaddress.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gio/gunixsocketaddress.c b/gio/gunixsocketaddress.c index b0d3c8fe4..27e195e47 100644 --- a/gio/gunixsocketaddress.c +++ b/gio/gunixsocketaddress.c @@ -66,7 +66,9 @@ enum PROP_ADDRESS_TYPE }; +#ifndef UNIX_PATH_MAX #define UNIX_PATH_MAX sizeof (((struct sockaddr_un *) 0)->sun_path) +#endif struct _GUnixSocketAddressPrivate { From 866275f56b525ea8115209c3dfc5e452a7534e21 Mon Sep 17 00:00:00 2001 From: Jehan Date: Sat, 9 Jun 2018 01:37:35 +0200 Subject: [PATCH 3/3] gio: fix various "warning: unused variable". --- gio/glocalfileinfo.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gio/glocalfileinfo.c b/gio/glocalfileinfo.c index df0352a8a..c1d0c2a8d 100644 --- a/gio/glocalfileinfo.c +++ b/gio/glocalfileinfo.c @@ -1119,8 +1119,10 @@ lookup_uid_data (uid_t uid) char buffer[4096]; struct passwd pwbuf; struct passwd *pwbufp; +#ifndef __BIONIC__ char *gecos, *comma; - +#endif + if (uid_cache == NULL) uid_cache = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify)uid_data_free); @@ -1205,10 +1207,12 @@ static char * lookup_gid_name (gid_t gid) { char *name; +#if defined (HAVE_GETGRGID_R) char buffer[4096]; struct group gbuf; +#endif struct group *gbufp; - + if (gid_cache == NULL) gid_cache = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify)g_free);