changeset 40151:db994b489ff2

relocatable-prog: Use Linux code on Android. * lib/progreloc.c: Treat Android like Linux.
author Bruno Haible <bruno@clisp.org>
date Sun, 27 Jan 2019 11:37:46 +0100
parents dd38f4180e3f
children 7972ff22b3cf
files ChangeLog lib/progreloc.c
diffstat 2 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Jan 27 04:57:32 2019 +0100
+++ b/ChangeLog	Sun Jan 27 11:37:46 2019 +0100
@@ -1,3 +1,8 @@
+2019-01-27  Bruno Haible  <bruno@clisp.org>
+
+	relocatable-prog: Use Linux code on Android.
+	* lib/progreloc.c: Treat Android like Linux.
+
 2019-01-26  Bruno Haible  <bruno@clisp.org>
 
 	getloadavg: Add support for Android.
--- a/lib/progreloc.c	Sun Jan 27 04:57:32 2019 +0100
+++ b/lib/progreloc.c	Sun Jan 27 11:37:46 2019 +0100
@@ -102,7 +102,7 @@
 
 #if ENABLE_RELOCATABLE
 
-#if defined __linux__ || defined __CYGWIN__
+#if defined __linux__ || defined __ANDROID__ || defined __CYGWIN__
 /* File descriptor of the executable.
    (Only used to verify that we find the correct executable.)  */
 static int executable_fd = -1;
@@ -118,7 +118,7 @@
     return false;
 #endif
 
-#if defined __linux__ || defined __CYGWIN__
+#if defined __linux__ || defined __ANDROID__ || defined __CYGWIN__
   if (executable_fd >= 0)
     {
       /* If we already have an executable_fd, check that filename points to
@@ -180,7 +180,7 @@
 
   return xstrdup (location);
 #else /* Unix */
-# ifdef __linux__
+# if defined __linux__ || defined __ANDROID__
   /* The executable is accessible as /proc/<pid>/exe.  In newer Linux
      versions, also as /proc/self/exe.  Linux >= 2.1 provides a symlink
      to the true pathname; older Linux versions give only device and ino,