]> Savannah Git Hosting - gnulib.git/commitdiff
tempname: merge 64-bit time_t fix from glibc
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 22 Aug 2022 19:22:52 +0000 (12:22 -0700)
committerBruno Haible <bruno@clisp.org>
Wed, 31 Aug 2022 23:28:47 +0000 (01:28 +0200)
This merges glibc commit 52a5fe70a2c77935afe807fb6e904e512ddd894e
"Use 64 bit time_t stat internally".
* lib/tempname.c (struct_stat64) [_LIBC]: Use struct __stat64_t64.
(__lstat64_time64) [!_LIBC]: Rename from __lstat64.
All uses changed.
(direxists): Use __stat64_time64 instead of __stat64.

ChangeLog
lib/tempname.c

index 38d10991f9021c5dead525c61cb504442fda7c76..72df093aba33b64fe541de9e85c6f08c4eb24380 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2022-08-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       tempname: merge 64-bit time_t fix from glibc
+       This merges glibc commit 52a5fe70a2c77935afe807fb6e904e512ddd894e
+       "Use 64 bit time_t stat internally".
+       * lib/tempname.c (struct_stat64) [_LIBC]: Use struct __stat64_t64.
+       (__lstat64_time64) [!_LIBC]: Rename from __lstat64.
+       All uses changed.
+       (direxists): Use __stat64_time64 instead of __stat64.
+
 2022-08-16  Bruno Haible  <bruno@clisp.org>
 
        tempname: Add more tests.
index 5adfe629a88248694c7ca832e8a5fdb328a148e2..4f615b90b977ac1b49e3941e00772966a5671c3f 100644 (file)
 #include <time.h>
 
 #if _LIBC
-# define struct_stat64 struct stat64
+# define struct_stat64 struct __stat64_t64
 # define __secure_getenv __libc_secure_getenv
 #else
 # define struct_stat64 struct stat
 # define __gen_tempname gen_tempname
 # define __mkdir mkdir
 # define __open open
-# define __lstat64(file, buf) lstat (file, buf)
+# define __lstat64_time64(file, buf) lstat (file, buf)
 # define __stat64(file, buf) stat (file, buf)
 # define __getrandom getrandom
 # define __clock_gettime64 clock_gettime
@@ -105,7 +105,7 @@ static int
 direxists (const char *dir)
 {
   struct_stat64 buf;
-  return __stat64 (dir, &buf) == 0 && S_ISDIR (buf.st_mode);
+  return __stat64_time64 (dir, &buf) == 0 && S_ISDIR (buf.st_mode);
 }
 
 /* Path search algorithm, for tmpnam, tmpfile, etc.  If DIR is
@@ -197,7 +197,7 @@ try_nocreate (char *tmpl, _GL_UNUSED void *flags)
 {
   struct_stat64 st;
 
-  if (__lstat64 (tmpl, &st) == 0 || errno == EOVERFLOW)
+  if (__lstat64_time64 (tmpl, &st) == 0 || errno == EOVERFLOW)
     __set_errno (EEXIST);
   return errno == ENOENT ? 0 : -1;
 }