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

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