|
|
b2a9b0 |
Partial backport of:
|
|
|
b2a9b0 |
|
|
|
b2a9b0 |
commit 04986243d1af37ac0177ed2f9db0a066ebd2b212
|
|
|
b2a9b0 |
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
|
|
b2a9b0 |
Date: Wed Jul 15 19:35:58 2020 +0000
|
|
|
b2a9b0 |
|
|
|
b2a9b0 |
Remove internal usage of extensible stat functions
|
|
|
b2a9b0 |
|
|
|
b2a9b0 |
It replaces the internal usage of __{f,l}xstat{at}{64} with the
|
|
|
b2a9b0 |
__{f,l}stat{at}{64}. It should not change the generate code since
|
|
|
b2a9b0 |
sys/stat.h explicit defines redirections to internal calls back to
|
|
|
b2a9b0 |
xstat* symbols.
|
|
|
b2a9b0 |
|
|
|
b2a9b0 |
Checked with a build for all affected ABIs. I also check on
|
|
|
b2a9b0 |
x86_64-linux-gnu and i686-linux-gnu.
|
|
|
b2a9b0 |
|
|
|
b2a9b0 |
Reviewed-by: Lukasz Majewski <lukma@denx.de>
|
|
|
b2a9b0 |
|
|
|
b2a9b0 |
Only the changes to include/sys/stat.h and sysdeps/posix/tempname.c
|
|
|
b2a9b0 |
are included here.
|
|
|
b2a9b0 |
|
|
|
b2a9b0 |
diff --git a/include/sys/stat.h b/include/sys/stat.h
|
|
|
b2a9b0 |
index b82d4527801d4797..c5b1938b87c9c5c3 100644
|
|
|
b2a9b0 |
--- a/include/sys/stat.h
|
|
|
b2a9b0 |
+++ b/include/sys/stat.h
|
|
|
b2a9b0 |
@@ -52,6 +52,7 @@ extern __typeof (__fxstatat64) __fxstatat64 attribute_hidden;
|
|
|
b2a9b0 |
#define lstat64(fname, buf) __lxstat64 (_STAT_VER, fname, buf)
|
|
|
b2a9b0 |
#define __lstat64(fname, buf) __lxstat64 (_STAT_VER, fname, buf)
|
|
|
b2a9b0 |
#define stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf)
|
|
|
b2a9b0 |
+#define __stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf)
|
|
|
b2a9b0 |
#define fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf)
|
|
|
b2a9b0 |
#define __fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf)
|
|
|
b2a9b0 |
#define fstat(fd, buf) __fxstat (_STAT_VER, fd, buf)
|
|
|
b2a9b0 |
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c
|
|
|
b2a9b0 |
index 61d7a9f36d37abae..a7b404cf4410cb00 100644
|
|
|
b2a9b0 |
--- a/sysdeps/posix/tempname.c
|
|
|
b2a9b0 |
+++ b/sysdeps/posix/tempname.c
|
|
|
b2a9b0 |
@@ -66,7 +66,6 @@
|
|
|
b2a9b0 |
# define __gettimeofday gettimeofday
|
|
|
b2a9b0 |
# define __mkdir mkdir
|
|
|
b2a9b0 |
# define __open open
|
|
|
b2a9b0 |
-# define __lxstat64(version, file, buf) lstat (file, buf)
|
|
|
b2a9b0 |
# define __secure_getenv secure_getenv
|
|
|
b2a9b0 |
#endif
|
|
|
b2a9b0 |
|
|
|
b2a9b0 |
@@ -97,7 +96,7 @@ static int
|
|
|
b2a9b0 |
direxists (const char *dir)
|
|
|
b2a9b0 |
{
|
|
|
b2a9b0 |
struct_stat64 buf;
|
|
|
b2a9b0 |
- return __xstat64 (_STAT_VER, dir, &buf) == 0 && S_ISDIR (buf.st_mode);
|
|
|
b2a9b0 |
+ return __stat64 (dir, &buf) == 0 && S_ISDIR (buf.st_mode);
|
|
|
b2a9b0 |
}
|
|
|
b2a9b0 |
|
|
|
b2a9b0 |
/* Path search algorithm, for tmpnam, tmpfile, etc. If DIR is
|
|
|
b2a9b0 |
@@ -252,10 +251,10 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
|
|
|
b2a9b0 |
|
|
|
b2a9b0 |
case __GT_NOCREATE:
|
|
|
b2a9b0 |
/* This case is backward from the other three. __gen_tempname
|
|
|
b2a9b0 |
- succeeds if __xstat fails because the name does not exist.
|
|
|
b2a9b0 |
+ succeeds if lstat fails because the name does not exist.
|
|
|
b2a9b0 |
Note the continue to bypass the common logic at the bottom
|
|
|
b2a9b0 |
of the loop. */
|
|
|
b2a9b0 |
- if (__lxstat64 (_STAT_VER, tmpl, &st) < 0)
|
|
|
b2a9b0 |
+ if (__lstat64 (tmpl, &st) < 0)
|
|
|
b2a9b0 |
{
|
|
|
b2a9b0 |
if (errno == ENOENT)
|
|
|
b2a9b0 |
{
|