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

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