+2019-02-19 Bruno Haible <bruno@clisp.org>
+
+ 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 <bruno@clisp.org>
gnulib-tool: Support --import with just a few tests, not --with-tests.
#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;
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
return xstrdup (location);
#else /* Unix */
-# if defined __linux__ || defined __ANDROID__
+# if defined __linux__
/* 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,
}
}
# 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/<pid>/exe, at least in
Cygwin >= 1.5. */