Tom G. Christensen wrote:
> FWIW lib/utime.c now fails to build on Solaris < 10 because of 
> 0003-stat-failing-with-EOVERFLOW-implies-existence.patch 
> (340dcbd879d050aebcd7081ec5f2208f0e2418b6)
> 
> gcc -std=gnu11 -DHAVE_CONFIG_H -DEXEEXT=\"\" -DEXEEXT=\"\" -DNO_XMALLOC 
> -DEXEEXT=\"\" -I. -I..  -DGNULIB_STRICT_CHECKING=1 
> -I/usr/tgcware/include -D_REENTRANT -fvisibility=hidden -g -O2 -MT 
> utime.o -MD -MP -MF $depbase.Tpo -c -o utime.o utime.c &&\
> mv -f $depbase.Tpo $depbase.Po
> utime.c: In function 'rpl_utime':
> utime.c:279:38: error: 'errno' undeclared (first use in this function)
>         if (stat (name, &buf) == -1 && errno != EOVERFLOW)
>                                        ^
> utime.c:279:38: note: each undeclared identifier is reported only once 
> for each function it appears in
> utime.c:279:47: error: 'EOVERFLOW' undeclared (first use in this function)
>         if (stat (name, &buf) == -1 && errno != EOVERFLOW)
>                                                 ^
> make[3]: *** [utime.o] Error 1
> 
> It seems it would need to include <errno.h> in the general case and not 
> just for Windows as currently done.

Thanks for the report. Probably it would also fail to compile on macOS 10.13.


2020-12-31  Bruno Haible  <br...@clisp.org>

        utime: Fix compilation error on macOS and Solaris 9 (regr. 2020-12-24).
        Reported by Tom G. Christensen <t...@jupiterrise.com> in
        <https://lists.gnu.org/archive/html/bug-gnulib/2020-12/msg00295.html>.
        * lib/utime.c: Include <errno.h>.

diff --git a/lib/utime.c b/lib/utime.c
index bf7d7c5..3372179 100644
--- a/lib/utime.c
+++ b/lib/utime.c
@@ -261,6 +261,7 @@ utime (const char *name, const struct utimbuf *ts)
 
 #else
 
+# include <errno.h>
 # include <sys/stat.h>
 # include "filename.h"
 


Reply via email to