From: Bruno Haible Date: Fri, 26 Apr 2019 23:09:31 +0000 (+0200) Subject: relocatable-prog: Fix gcc warning on mingw. X-Git-Tag: v1.0~4974 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=6c85dbeb368c55c7263263a76c88a9b88d402018;p=gnulib.git relocatable-prog: Fix gcc warning on mingw. * lib/progreloc.c (maybe_executable): Don't define on native Windows and on EMX. --- diff --git a/ChangeLog b/ChangeLog index 3e9d27a766..594a3d182d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2019-04-26 Bruno Haible + + relocatable-prog: Fix gcc warning on mingw. + * lib/progreloc.c (maybe_executable): Don't define on native Windows and + on EMX. + 2019-04-02 Bruno Haible gitsub.sh: New file. diff --git a/lib/progreloc.c b/lib/progreloc.c index b3eb5030b3..9d81efa14b 100644 --- a/lib/progreloc.c +++ b/lib/progreloc.c @@ -151,17 +151,20 @@ full_read (int fd, void *buf, size_t count) static int executable_fd = -1; #endif +/* Define this function only when it's needed. */ +#if !(defined WINDOWS_NATIVE || defined __EMX__) + /* Tests whether a given pathname may belong to the executable. */ static bool maybe_executable (const char *filename) { /* The native Windows API lacks the access() function. */ -#if !defined WINDOWS_NATIVE +# if !defined WINDOWS_NATIVE if (access (filename, X_OK) < 0) return false; -#endif +# endif -#if defined __linux__ || defined __CYGWIN__ +# if defined __linux__ || defined __CYGWIN__ if (executable_fd >= 0) { /* If we already have an executable_fd, check that filename points to @@ -179,11 +182,13 @@ maybe_executable (const char *filename) return false; } } -#endif +# endif return true; } +#endif + /* Determine the full pathname of the current executable, freshly allocated. Return NULL if unknown. Guaranteed to work on Linux and native Windows. Likely to work on the