# HG changeset patch # User Bruno Haible # Date 1550608733 -3600 # Node ID e13b9344e430983c5e97fff9021d50461b4762c8 # Parent 7f943adad683dd2877b1d0fbef62dee4c14da234 progreloc: Simplify code for Android. * lib/progreloc.c (executable_fd): Don't define on Android. (maybe_executable, find_executable): Don't use executable_fd on Android. diff -r 7f943adad683 -r e13b9344e430 ChangeLog --- a/ChangeLog Tue Feb 19 08:54:45 2019 -0800 +++ b/ChangeLog Tue Feb 19 21:38:53 2019 +0100 @@ -1,3 +1,9 @@ +2019-02-19 Bruno Haible + + progreloc: Simplify code for Android. + * lib/progreloc.c (executable_fd): Don't define on Android. + (maybe_executable, find_executable): Don't use executable_fd on Android. + 2019-02-15 Bruno Haible gnulib-tool: Support --import with just a few tests, not --with-tests. diff -r 7f943adad683 -r e13b9344e430 lib/progreloc.c --- a/lib/progreloc.c Tue Feb 19 08:54:45 2019 -0800 +++ b/lib/progreloc.c Tue Feb 19 21:38:53 2019 +0100 @@ -102,7 +102,7 @@ #if ENABLE_RELOCATABLE -#if defined __linux__ || defined __ANDROID__ || defined __CYGWIN__ +#if defined __linux__ || 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 __ANDROID__ || defined __CYGWIN__ +#if defined __linux__ || 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 */ -# if defined __linux__ || defined __ANDROID__ +# if defined __linux__ /* The executable is accessible as /proc//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, @@ -205,6 +205,15 @@ } } # endif +# if defined __ANDROID__ + { + char *link; + + link = xreadlink ("/proc/self/exe"); + if (link != NULL) + return link; + } +# endif # ifdef __CYGWIN__ /* The executable is accessible as /proc//exe, at least in Cygwin >= 1.5. */