branch: master
commit 961aa57f1466dc2dcd28b8419deb4621865411a6
Author: Takashi Yano <takashi.y...@nifty.ne.jp>
AuthorDate: Thu Feb 20 01:37:27 2025 +0200

    ltmain.in: Fix mistaking a directory as an executable
    
    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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index c59459d0..36a85b9e 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -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

Reply via email to