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

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