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

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