devel/gmake: sync with upstream

Taken from: HardenedBSD
This commit is contained in:
Franco Fichtner 2020-05-22 06:17:46 +02:00
parent f36c6d6a86
commit 8cac7e31c3
2 changed files with 33 additions and 0 deletions

View file

@ -3,6 +3,7 @@
PORTNAME= gmake
PORTVERSION= 4.3
PORTREVISION= 1
CATEGORIES= devel
MASTER_SITES= GNU/make
DISTNAME= make-${PORTVERSION}

View file

@ -0,0 +1,32 @@
Backport of gnulib git commit 4c1009ec93e12ee34acd27f6d7e25442bedc16f2.
When the file found in a PATH element is a directory, continue searching.
--- lib/findprog-in.c.orig 2020-01-19 20:34:01 UTC
+++ lib/findprog-in.c
@@ -26,6 +26,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <sys/stat.h>
#include "filename.h"
#include "concat-filename.h"
@@ -190,6 +191,7 @@ find_in_given_path (const char *progname, const char *
dir = ".";
/* Try all platform-dependent suffixes. */
+ struct stat st;
for (i = 0; i < sizeof (suffixes) / sizeof (suffixes[0]); i++)
{
const char *suffix = suffixes[i];
@ -208,7 +210,8 @@ find_in_given_path (const char *progname, const char *
use it. On other systems, let's hope that this program
is not installed setuid or setgid, so that it is ok to
call access() despite its design flaw. */
- if (eaccess (progpathname, X_OK) == 0)
+ if (eaccess (progpathname, X_OK) == 0 &&
+ stat(progpathname, &st) == 0 && ! S_ISDIR(st.st_mode))
{
/* Found! */
if (strcmp (progpathname, progname) == 0)