summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2018-03-27 13:30:50 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2018-03-27 13:31:23 -0700
commit72fad885b68617db85901a8e810211b557a31f99 (patch)
tree4208da543025daeeec2ddaab26bf6bce81cf1ebf /lib
parent7bc31c1cd4b6a6eac0d29e31dbe3d208e2258ccf (diff)
downloademacs-72fad885b68617db85901a8e810211b557a31f99.tar.gz
Update from Gnulib
This incorporates: 2018-03-26 time_rz: work around Mac OS X 10.6 infloop 2018-03-20 euidaccess: Port to native Windows. * lib/euidaccess.c, lib/time_rz.c, m4/time_rz.m4: Copy from Gnulib.
Diffstat (limited to 'lib')
-rw-r--r--lib/euidaccess.c11
-rw-r--r--lib/time_rz.c15
2 files changed, 23 insertions, 3 deletions
diff --git a/lib/euidaccess.c b/lib/euidaccess.c
index aee693571c9..4f512f5af54 100644
--- a/lib/euidaccess.c
+++ b/lib/euidaccess.c
@@ -29,8 +29,11 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
-
-#include "root-uid.h"
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+# include <io.h>
+#else
+# include "root-uid.h"
+#endif
#if HAVE_LIBGEN_H
# include <libgen.h>
@@ -84,7 +87,9 @@ euidaccess (const char *file, int mode)
return accessx (file, mode, ACC_SELF);
#elif HAVE_EACCESS /* FreeBSD */
return eaccess (file, mode);
-#else /* Mac OS X, NetBSD, OpenBSD, HP-UX, Solaris, Cygwin, mingw, BeOS */
+#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* mingw */
+ return _access (file, mode);
+#else /* Mac OS X, NetBSD, OpenBSD, HP-UX, Solaris, Cygwin, BeOS */
uid_t uid = getuid ();
gid_t gid = getgid ();
diff --git a/lib/time_rz.c b/lib/time_rz.c
index c1eca888f2c..5293c7cf8dc 100644
--- a/lib/time_rz.c
+++ b/lib/time_rz.c
@@ -286,6 +286,21 @@ revert_tz (timezone_t tz)
struct tm *
localtime_rz (timezone_t tz, time_t const *t, struct tm *tm)
{
+#ifdef HAVE_LOCALTIME_INFLOOP_BUG
+ /* The -67768038400665599 comes from:
+ https://lists.gnu.org/r/bug-gnulib/2017-07/msg00142.html
+ On affected platforms the greatest POSIX-compatible time_t value
+ that could return nonnull is 67768036191766798 (when
+ TZ="XXX24:59:59" it resolves to the year 2**31 - 1 + 1900, on
+ 12-31 at 23:59:59), so test for that too while we're in the
+ neighborhood. */
+ if (! (-67768038400665599 <= *t && *t <= 67768036191766798))
+ {
+ errno = EOVERFLOW;
+ return NULL;
+ }
+#endif
+
if (!tz)
return gmtime_r (t, tm);
else