[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: request for minor change to canonicalize-lgpl.c
From: |
Bruno Haible |
Subject: |
Re: request for minor change to canonicalize-lgpl.c |
Date: |
Sun, 08 Aug 2021 22:14:49 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-210-generic; KDE/5.18.0; x86_64; ; ) |
Mike Fulton wrote:
> > I am building m4 (latest) on the z/OS operating system and for the most
> > part, things are going very well.
> > I am not sure of the best place to request this - whether as a 'bug' report
> > (which this is not) or as a discussion topic, so I decided on 'discussion'.
> >
> > The problem I have hit for z/OS is that canonicalize-lgpl.c is defining
> > __stat to stat, i.e.
> > #define __stat stat
> >
> > Unfortunately, on z/OS, the system header <sys/stat.h> uses __stat as a
> > wrapper for the header file to test if the header has been included or not,
> > e.g.
> >
> > #ifndef __stat
> > #define __stat 1
> > <header file contents>
> > #endif
Thanks for the explanation. Sending an explanation without a patch is
better than sending a patch without an explanation :)
Eric Blake wrote:
> we will get it fixed to quit
> using the identifier __stat for our own uses now that we know system
> headers are using it.
Done as follows:
2021-08-08 Bruno Haible <bruno@clisp.org>
canonicalize-lgpl: Fix conflict with z/OS <sys/stat.h>.
Reported by Mike Fulton <mikefultonpersonal@gmail.com> in
<https://lists.gnu.org/archive/html/m4-discuss/2021-08/msg00000.html>
via Eric Blake.
* lib/canonicalize-lgpl.c (__stat): Remove macro.
(file_accessible): Use 'stat' instead.
diff --git a/lib/canonicalize-lgpl.c b/lib/canonicalize-lgpl.c
index c6fef17..92e9639 100644
--- a/lib/canonicalize-lgpl.c
+++ b/lib/canonicalize-lgpl.c
@@ -74,7 +74,6 @@
# define __pathconf pathconf
# define __rawmemchr rawmemchr
# define __readlink readlink
-# define __stat stat
# if IN_RELOCWRAPPER
/* When building the relocatable program wrapper, use the system's memmove
function, not the gnulib override, otherwise we would get a link error.
@@ -105,7 +104,7 @@ file_accessible (char const *file)
return __faccessat (AT_FDCWD, file, F_OK, AT_EACCESS) == 0;
# else
struct stat st;
- return __stat (file, &st) == 0 || errno == EOVERFLOW;
+ return stat (file, &st) == 0 || errno == EOVERFLOW;
# endif
}