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

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