]> Savannah Git Hosting - gnulib.git/commitdiff
tempname: sync with proposed glibc patch
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 9 Jan 2021 01:31:28 +0000 (17:31 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 9 Jan 2021 01:56:15 +0000 (17:56 -0800)
This is from Adhemerval Zanella in:
https://sourceware.org/pipermail/libc-alpha/2021-January/121301.html
* lib/tempname.c (__lxstat64): Remove.
(__lstat64, __stat64): New replacement macros.  All uses changed.

ChangeLog
lib/tempname.c

index a2787f59ad8b99127a7239936bfee24821ff9279..812888f8e5b0c20ea62c9d951d63dd9cd1cbc5a2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2021-01-08  Paul Eggert  <eggert@cs.ucla.edu>
 
+       tempname: sync with proposed glibc patch
+       This is from Adhemerval Zanella in:
+       https://sourceware.org/pipermail/libc-alpha/2021-January/121301.html
+       * lib/tempname.c (__lxstat64): Remove.
+       (__lstat64, __stat64): New replacement macros.  All uses changed.
+
        regex: stop using alloca
        * lib/regex_internal.h: Do not include <alloca.h> or define
        __libc_use_alloca or alloca.  Patch written by Adhemerval Zanella:
index 9ed67fec2ca04f64ba2d8885ba105f92de55ce48..f196b98622e2e247fc09afaacd70dacb91da8224 100644 (file)
@@ -61,7 +61,8 @@
 # define __gen_tempname gen_tempname
 # define __mkdir mkdir
 # define __open open
-# define __lxstat64(version, file, buf) lstat (file, buf)
+# define __lstat64(file, buf) lstat (file, buf)
+# define __stat64(file, buf) stat (file, buf)
 # define __getrandom getrandom
 # define __clock_gettime64 clock_gettime
 # define __timespec64 timespec
@@ -96,7 +97,7 @@ static int
 direxists (const char *dir)
 {
   struct_stat64 buf;
-  return __xstat64 (_STAT_VER, dir, &buf) == 0 && S_ISDIR (buf.st_mode);
+  return __stat64 (dir, &buf) == 0 && S_ISDIR (buf.st_mode);
 }
 
 /* Path search algorithm, for tmpnam, tmpfile, etc.  If DIR is
@@ -188,7 +189,7 @@ try_nocreate (char *tmpl, void *flags _GL_UNUSED)
 {
   struct_stat64 st;
 
-  if (__lxstat64 (_STAT_VER, tmpl, &st) == 0 || errno == EOVERFLOW)
+  if (__lstat64 (tmpl, &st) == 0 || errno == EOVERFLOW)
     __set_errno (EEXIST);
   return errno == ENOENT ? 0 : -1;
 }