From: Paul Eggert <eggert@cs.ucla.edu>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: libc-alpha@sourceware.org, bug-gnulib@gnu.org
Subject: Re: [PATCH 1/2] posix: Sync tempname with gnulib [BZ #26648]
Date: Fri, 8 Jan 2021 17:58:05 -0800 [thread overview]
Message-ID: <4fcd6040-263a-0278-fe84-914dacb6e992@cs.ucla.edu> (raw)
In-Reply-To: <20210104170349.3681241-1-adhemerval.zanella@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 498 bytes --]
On 1/4/21 9:03 AM, Adhemerval Zanella wrote:
> -# define __lstat64(version, file, buf) lstat (file, buf)
> +# define __lxstat64(version, file, buf) lstat (file, buf)
That change isn't quite right for the !_LIBC case, since it doesn't
define the __stat64 macro and it defines __lstat64 with the wrong API.
I installed the attached patch into Gnulib, which should do the change
right for both Gnulib and glibc, the idea being that the Gnulib and
glibc source files can be identical.
[-- Attachment #2: 0001-tempname-sync-with-proposed-glibc-patch.patch --]
[-- Type: text/x-patch, Size: 2252 bytes --]
From 8eb0e08598b9815f0e85ce1bde676169920087ef Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Fri, 8 Jan 2021 17:31:28 -0800
Subject: [PATCH] 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.
---
ChangeLog | 6 ++++++
lib/tempname.c | 7 ++++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a2787f59a..812888f8e 100644
--- 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:
diff --git a/lib/tempname.c b/lib/tempname.c
index 9ed67fec2..f196b9862 100644
--- a/lib/tempname.c
+++ b/lib/tempname.c
@@ -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;
}
--
2.27.0
next prev parent reply other threads:[~2021-01-09 1:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-04 17:03 [PATCH 1/2] posix: Sync tempname with gnulib [BZ #26648] Adhemerval Zanella
2021-01-04 17:03 ` [PATCH 2/2] posix: Improve randomness on try_tempname_len Adhemerval Zanella
2021-01-09 2:20 ` Paul Eggert
2021-01-11 12:29 ` Adhemerval Zanella
2021-01-12 1:06 ` Paul Eggert
2021-01-09 1:58 ` Paul Eggert [this message]
2021-01-11 12:30 ` [PATCH 1/2] posix: Sync tempname with gnulib [BZ #26648] Adhemerval Zanella
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4fcd6040-263a-0278-fe84-914dacb6e992@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=adhemerval.zanella@linaro.org \
--cc=bug-gnulib@gnu.org \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).