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

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