Blame SOURCES/make-4.2.1-glob-fix-2.patch

f55833
From 193f1e81edd6b1b56b0eb0ff8aa4b41c7b4257b4 Mon Sep 17 00:00:00 2001
f55833
From: Paul Eggert <eggert@cs.ucla.edu>
f55833
Date: Sun, 24 Sep 2017 09:12:58 -0400
f55833
Subject: glob: Do not assume glibc glob internals.
f55833
f55833
It has been proposed that glibc glob start using gl_lstat,
f55833
which the API allows it to do.  GNU 'make' should not get in
f55833
the way of this.  See:
f55833
https://sourceware.org/ml/libc-alpha/2017-09/msg00409.html
f55833
f55833
* dir.c (local_lstat): New function, like local_stat.
f55833
(dir_setup_glob): Use it to initialize gl_lstat too, as the API
f55833
requires.
f55833
---
f55833
 dir.c | 29 +++++++++++++++++++++++++++--
f55833
 1 file changed, 27 insertions(+), 2 deletions(-)
f55833
f55833
diff --git a/dir.c b/dir.c
f55833
index adbb8a9..c343e4c 100644
f55833
--- a/dir.c
f55833
+++ b/dir.c
f55833
@@ -1299,15 +1299,40 @@ local_stat (const char *path, struct stat *buf)
f55833
 }
f55833
 #endif
f55833
 
f55833
+/* Similarly for lstat.  */
f55833
+#if !defined(lstat) && !defined(WINDOWS32) || defined(VMS)
f55833
+# ifndef VMS
f55833
+#  ifndef HAVE_SYS_STAT_H
f55833
+int lstat (const char *path, struct stat *sbuf);
f55833
+#  endif
f55833
+# else
f55833
+    /* We are done with the fake lstat.  Go back to the real lstat */
f55833
+#   ifdef lstat
f55833
+#     undef lstat
f55833
+#   endif
f55833
+# endif
f55833
+# define local_lstat lstat
f55833
+#elif defined(WINDOWS32)
f55833
+/* Windows doesn't support lstat().  */
f55833
+# define local_lstat local_stat
f55833
+#else
f55833
+static int
f55833
+local_lstat (const char *path, struct stat *buf)
f55833
+{
f55833
+  int e;
f55833
+  EINTRLOOP (e, lstat (path, buf));
f55833
+  return e;
f55833
+}
f55833
+#endif
f55833
+
f55833
 void
f55833
 dir_setup_glob (glob_t *gl)
f55833
 {
f55833
   gl->gl_opendir = open_dirstream;
f55833
   gl->gl_readdir = read_dirstream;
f55833
   gl->gl_closedir = free;
f55833
+  gl->gl_lstat = local_lstat;
f55833
   gl->gl_stat = local_stat;
f55833
-  /* We don't bother setting gl_lstat, since glob never calls it.
f55833
-     The slot is only there for compatibility with 4.4 BSD.  */
f55833
 }
f55833
 
f55833
 void
f55833
-- 
f55833
cgit v1.0-41-gc330
f55833