]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
ltmain.in: Fix mistaking a directory as an executable
authorTakashi Yano <takashi.yano@nifty.ne.jp>
Wed, 19 Feb 2025 23:37:27 +0000 (01:37 +0200)
committerIleana Dumitrescu <ileanadumitrescu95@gmail.com>
Fri, 11 Apr 2025 17:38:16 +0000 (20:38 +0300)
find_executable() can return a directory of the same name as the target
executable if the directory is found earlier in the PATH, which causes
check_executable() to fail.

Reported: https://savannah.gnu.org/support/?111191

* build-aux/ltmain.in: Check if directory is found before executable
  in the PATH.

build-aux/ltmain.in

index c59459d05b96fb699a0d2f7a52eb235d2490ec64..36a85b9e1257ef5db182a072452199455d9a9105 100644 (file)
@@ -4241,7 +4241,7 @@ check_executable (const char *path)
   if ((!path) || (!*path))
     return 0;
 
-  if ((stat (path, &st) >= 0)
+  if ((stat (path, &st) >= 0) && !S_ISDIR (st.st_mode)
       && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
     return 1;
   else