mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-24 14:00:30 +00:00
Remove internal usage of extensible stat functions
It replaces the internal usage of __{f,l}xstat{at}{64} with the __{f,l}stat{at}{64}. It should not change the generate code since sys/stat.h explicit defines redirections to internal calls back to xstat* symbols. Checked with a build for all affected ABIs. I also check on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
This commit is contained in:
parent
2315996215
commit
04986243d1
@ -194,7 +194,7 @@ __open_catalog (const char *cat_name, const char *nlspath, const char *env_var,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) < 0)
|
||||
if (__builtin_expect (__fstat64 (fd, &st), 0) < 0)
|
||||
goto close_unlock_return;
|
||||
|
||||
if (__builtin_expect (!S_ISREG (st.st_mode), 0)
|
||||
|
@ -71,7 +71,7 @@ check_one_fd (int fd, int mode)
|
||||
decsriptor numbers, in this order. */
|
||||
struct stat64 st;
|
||||
if (__builtin_expect (nullfd != fd, 0)
|
||||
|| __builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) != 0
|
||||
|| __builtin_expect (__fstat64 (fd, &st), 0) != 0
|
||||
|| __builtin_expect (S_ISCHR (st.st_mode), 1) == 0
|
||||
|| st.st_rdev != dev)
|
||||
/* We cannot even give an error message here since it would
|
||||
|
@ -163,7 +163,7 @@ print_cache (const char *cache_name)
|
||||
error (EXIT_FAILURE, errno, _("Can't open cache file %s\n"), cache_name);
|
||||
|
||||
struct stat64 st;
|
||||
if (fstat64 (fd, &st) < 0
|
||||
if (__fstat64 (fd, &st) < 0
|
||||
/* No need to map the file if it is empty. */
|
||||
|| st.st_size == 0)
|
||||
{
|
||||
@ -699,7 +699,7 @@ load_aux_cache (const char *aux_cache_name)
|
||||
}
|
||||
|
||||
struct stat64 st;
|
||||
if (fstat64 (fd, &st) < 0 || st.st_size < sizeof (struct aux_cache_file))
|
||||
if (__fstat64 (fd, &st) < 0 || st.st_size < sizeof (struct aux_cache_file))
|
||||
{
|
||||
close (fd);
|
||||
init_aux_cache ();
|
||||
|
@ -1914,7 +1914,7 @@ open_path (const char *name, size_t namelen, int mode,
|
||||
|
||||
buf[buflen - namelen - 1] = '\0';
|
||||
|
||||
if (__xstat64 (_STAT_VER, buf, &st) != 0
|
||||
if (__stat64 (buf, &st) != 0
|
||||
|| ! S_ISDIR (st.st_mode))
|
||||
/* The directory does not exist or it is no directory. */
|
||||
this_dir->status[cnt] = nonexisting;
|
||||
@ -1934,7 +1934,7 @@ open_path (const char *name, size_t namelen, int mode,
|
||||
directories and so exploit the bugs. */
|
||||
struct stat64 st;
|
||||
|
||||
if (__fxstat64 (_STAT_VER, fd, &st) != 0
|
||||
if (__fstat64 (fd, &st) != 0
|
||||
|| (st.st_mode & S_ISUID) == 0)
|
||||
{
|
||||
/* The shared object cannot be tested for being SUID
|
||||
|
@ -47,7 +47,7 @@ _dl_sysdep_read_whole_file (const char *file, size_t *sizep, int prot)
|
||||
int fd = __open64_nocancel (file, O_RDONLY | O_CLOEXEC);
|
||||
if (fd >= 0)
|
||||
{
|
||||
if (__fxstat64 (_STAT_VER, fd, &st) >= 0)
|
||||
if (__fstat64 (fd, &st) >= 0)
|
||||
{
|
||||
*sizep = st.st_size;
|
||||
|
||||
|
@ -342,7 +342,7 @@ _dl_start_profile (void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (__fxstat64 (_STAT_VER, fd, &st) < 0 || !S_ISREG (st.st_mode))
|
||||
if (__fstat64 (fd, &st) < 0 || !S_ISREG (st.st_mode))
|
||||
{
|
||||
/* Not stat'able or not a regular file => don't use it. */
|
||||
errstr = "%s: cannot stat file: %s\n";
|
||||
|
@ -64,7 +64,7 @@ __gconv_load_cache (void)
|
||||
return -1;
|
||||
|
||||
/* Get information about the file. */
|
||||
if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) < 0
|
||||
if (__builtin_expect (__fstat64 (fd, &st), 0) < 0
|
||||
/* We do not have to start looking at the file if it cannot contain
|
||||
at least the cache header. */
|
||||
|| (size_t) st.st_size < sizeof (struct gconvcache_header))
|
||||
|
@ -53,6 +53,7 @@ extern __typeof (__fxstatat64) __fxstatat64 attribute_hidden;
|
||||
#define lstat64(fname, buf) __lxstat64 (_STAT_VER, fname, buf)
|
||||
#define __lstat64(fname, buf) __lxstat64 (_STAT_VER, fname, buf)
|
||||
#define stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf)
|
||||
#define __stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf)
|
||||
#define fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf)
|
||||
#define __fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf)
|
||||
#define fstat(fd, buf) __fxstat (_STAT_VER, fd, buf)
|
||||
|
@ -474,7 +474,7 @@ iruserfopen (const char *file, uid_t okuser)
|
||||
/* If not a regular file, if owned by someone other than user or
|
||||
root, if writeable by anyone but the owner, or if hardlinked
|
||||
anywhere, quit. */
|
||||
if (__lxstat64 (_STAT_VER, file, &st))
|
||||
if (__lstat64 (file, &st))
|
||||
cp = _("lstat failed");
|
||||
else if (!S_ISREG (st.st_mode))
|
||||
cp = _("not regular file");
|
||||
@ -483,7 +483,7 @@ iruserfopen (const char *file, uid_t okuser)
|
||||
res = fopen (file, "rce");
|
||||
if (!res)
|
||||
cp = _("cannot open");
|
||||
else if (__fxstat64 (_STAT_VER, fileno (res), &st) < 0)
|
||||
else if (__fstat64 (fileno (res), &st) < 0)
|
||||
cp = _("fstat failed");
|
||||
else if (st.st_uid && st.st_uid != okuser)
|
||||
cp = _("bad owner");
|
||||
|
@ -174,7 +174,7 @@ next:
|
||||
break;
|
||||
case PASSWD:
|
||||
if (strcmp(*aname, "anonymous") &&
|
||||
fstat64(fileno(cfile), &stb) >= 0 &&
|
||||
__fstat64(fileno(cfile), &stb) >= 0 &&
|
||||
(stb.st_mode & 077) != 0) {
|
||||
warnx(_("Error: .netrc file is readable by others."));
|
||||
warnx(_("Remove 'password' line or make file unreadable by others."));
|
||||
|
@ -804,7 +804,7 @@ _nl_load_domain (struct loaded_l10nfile *domain_file,
|
||||
/* We must know about the size of the file. */
|
||||
if (
|
||||
#ifdef _LIBC
|
||||
__builtin_expect (fstat64 (fd, &st) != 0, 0)
|
||||
__builtin_expect (__fstat64 (fd, &st) != 0, 0)
|
||||
#else
|
||||
__builtin_expect (fstat (fd, &st) != 0, 0)
|
||||
#endif
|
||||
|
@ -67,7 +67,7 @@ __file_change_detection_for_path (struct file_change_detection *file,
|
||||
const char *path)
|
||||
{
|
||||
struct stat64 st;
|
||||
if (stat64 (path, &st) != 0)
|
||||
if (__stat64 (path, &st) != 0)
|
||||
switch (errno)
|
||||
{
|
||||
case EACCES:
|
||||
@ -105,7 +105,7 @@ __file_change_detection_for_fp (struct file_change_detection *file,
|
||||
else
|
||||
{
|
||||
struct stat64 st;
|
||||
if (fstat64 (__fileno (fp), &st) != 0)
|
||||
if (__fstat64 (__fileno (fp), &st) != 0)
|
||||
/* If we already have a file descriptor, all errors are fatal. */
|
||||
return false;
|
||||
else
|
||||
|
15
io/fts.c
15
io/fts.c
@ -81,8 +81,9 @@ static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94";
|
||||
# define FTSOBJ FTS
|
||||
# define FTSENTRY FTSENT
|
||||
# define INO_T ino_t
|
||||
# define STAT stat
|
||||
# define LSTAT lstat
|
||||
# define STRUCT_STAT stat
|
||||
# define STAT __stat
|
||||
# define LSTAT __lstat
|
||||
#endif
|
||||
|
||||
static FTSENTRY *fts_alloc (FTSOBJ *, const char *, size_t);
|
||||
@ -872,7 +873,7 @@ fts_stat (FTSOBJ *sp, FTSENTRY *p, int follow)
|
||||
FTSENTRY *t;
|
||||
dev_t dev;
|
||||
INO_T ino;
|
||||
struct STAT *sbp, sb;
|
||||
struct STRUCT_STAT *sbp, sb;
|
||||
int saved_errno;
|
||||
|
||||
/* If user needs stat info, stat buffer already allocated. */
|
||||
@ -906,7 +907,7 @@ fts_stat (FTSOBJ *sp, FTSENTRY *p, int follow)
|
||||
}
|
||||
} else if (LSTAT(p->fts_accpath, sbp)) {
|
||||
p->fts_errno = errno;
|
||||
err: memset(sbp, 0, sizeof(struct STAT));
|
||||
err: memset(sbp, 0, sizeof(struct STRUCT_STAT));
|
||||
return (FTS_NS);
|
||||
}
|
||||
|
||||
@ -996,7 +997,7 @@ fts_alloc (FTSOBJ *sp, const char *name, size_t namelen)
|
||||
*/
|
||||
len = sizeof(FTSENTRY) + namelen;
|
||||
if (!ISSET(FTS_NOSTAT))
|
||||
len += sizeof(struct STAT) + ALIGNBYTES;
|
||||
len += sizeof(struct STRUCT_STAT) + ALIGNBYTES;
|
||||
if ((p = malloc(len)) == NULL)
|
||||
return (NULL);
|
||||
|
||||
@ -1005,7 +1006,7 @@ fts_alloc (FTSOBJ *sp, const char *name, size_t namelen)
|
||||
p->fts_name[namelen] = '\0';
|
||||
|
||||
if (!ISSET(FTS_NOSTAT))
|
||||
p->fts_statp = (struct STAT *)ALIGN(p->fts_name + namelen + 2);
|
||||
p->fts_statp = (struct STRUCT_STAT *)ALIGN(p->fts_name + namelen + 2);
|
||||
p->fts_namelen = namelen;
|
||||
p->fts_path = sp->fts_path;
|
||||
p->fts_errno = 0;
|
||||
@ -1116,7 +1117,7 @@ fts_safe_changedir (FTSOBJ *sp, FTSENTRY *p, int fd, const char *path)
|
||||
return (0);
|
||||
if (fd < 0 && (newfd = __open(path, O_RDONLY, 0)) < 0)
|
||||
return (-1);
|
||||
if (__fxstat64(_STAT_VER, newfd, &sb)) {
|
||||
if (__fstat64(newfd, &sb)) {
|
||||
ret = -1;
|
||||
goto bail;
|
||||
}
|
||||
|
@ -24,7 +24,8 @@
|
||||
#define FTSOBJ FTS64
|
||||
#define FTSENTRY FTSENT64
|
||||
#define INO_T ino64_t
|
||||
#define STAT stat64
|
||||
#define LSTAT lstat64
|
||||
#define STRUCT_STAT stat64
|
||||
#define STAT __stat64
|
||||
#define LSTAT __lstat64
|
||||
|
||||
#include "fts.c"
|
||||
|
46
io/ftw.c
46
io/ftw.c
@ -135,15 +135,15 @@ int rpl_lstat (const char *, struct stat *);
|
||||
# define NFTW_OLD_NAME __old_nftw
|
||||
# define NFTW_NEW_NAME __new_nftw
|
||||
# define INO_T ino_t
|
||||
# define STAT stat
|
||||
# define STRUCT_STAT stat
|
||||
# ifdef _LIBC
|
||||
# define LXSTAT __lxstat
|
||||
# define XSTAT __xstat
|
||||
# define FXSTATAT __fxstatat
|
||||
# define LSTAT __lstat
|
||||
# define STAT __stat
|
||||
# define FSTATAT __fstatat
|
||||
# else
|
||||
# define LXSTAT(V,f,sb) lstat (f,sb)
|
||||
# define XSTAT(V,f,sb) stat (f,sb)
|
||||
# define FXSTATAT(V,d,f,sb,m) fstatat (d, f, sb, m)
|
||||
# define LSTAT lstat
|
||||
# define XTAT stat
|
||||
# define FSTATAT fstatat
|
||||
# endif
|
||||
# define FTW_FUNC_T __ftw_func_t
|
||||
# define NFTW_FUNC_T __nftw_func_t
|
||||
@ -219,7 +219,7 @@ static const int ftw_arr[] =
|
||||
|
||||
|
||||
/* Forward declarations of local functions. */
|
||||
static int ftw_dir (struct ftw_data *data, struct STAT *st,
|
||||
static int ftw_dir (struct ftw_data *data, struct STRUCT_STAT *st,
|
||||
struct dir_data *old_dir);
|
||||
|
||||
|
||||
@ -239,7 +239,7 @@ object_compare (const void *p1, const void *p2)
|
||||
|
||||
|
||||
static int
|
||||
add_object (struct ftw_data *data, struct STAT *st)
|
||||
add_object (struct ftw_data *data, struct STRUCT_STAT *st)
|
||||
{
|
||||
struct known_object *newp = malloc (sizeof (struct known_object));
|
||||
if (newp == NULL)
|
||||
@ -251,7 +251,7 @@ add_object (struct ftw_data *data, struct STAT *st)
|
||||
|
||||
|
||||
static inline int
|
||||
find_object (struct ftw_data *data, struct STAT *st)
|
||||
find_object (struct ftw_data *data, struct STRUCT_STAT *st)
|
||||
{
|
||||
struct known_object obj;
|
||||
obj.dev = st->st_dev;
|
||||
@ -378,7 +378,7 @@ static int
|
||||
process_entry (struct ftw_data *data, struct dir_data *dir, const char *name,
|
||||
size_t namlen, int d_type)
|
||||
{
|
||||
struct STAT st;
|
||||
struct STRUCT_STAT st;
|
||||
int result = 0;
|
||||
int flag = 0;
|
||||
size_t new_buflen;
|
||||
@ -405,16 +405,16 @@ process_entry (struct ftw_data *data, struct dir_data *dir, const char *name,
|
||||
|
||||
int statres;
|
||||
if (dir->streamfd != -1)
|
||||
statres = FXSTATAT (_STAT_VER, dir->streamfd, name, &st,
|
||||
(data->flags & FTW_PHYS) ? AT_SYMLINK_NOFOLLOW : 0);
|
||||
statres = FSTATAT (dir->streamfd, name, &st,
|
||||
(data->flags & FTW_PHYS) ? AT_SYMLINK_NOFOLLOW : 0);
|
||||
else
|
||||
{
|
||||
if ((data->flags & FTW_CHDIR) == 0)
|
||||
name = data->dirbuf;
|
||||
|
||||
statres = ((data->flags & FTW_PHYS)
|
||||
? LXSTAT (_STAT_VER, name, &st)
|
||||
: XSTAT (_STAT_VER, name, &st));
|
||||
? LSTAT (name, &st)
|
||||
: STAT (name, &st));
|
||||
}
|
||||
|
||||
if (statres < 0)
|
||||
@ -430,10 +430,10 @@ process_entry (struct ftw_data *data, struct dir_data *dir, const char *name,
|
||||
it should contain information about the link (ala lstat).
|
||||
We do our best to fill in what data we can. */
|
||||
if (dir->streamfd != -1)
|
||||
statres = FXSTATAT (_STAT_VER, dir->streamfd, name, &st,
|
||||
AT_SYMLINK_NOFOLLOW);
|
||||
statres = FSTATAT (dir->streamfd, name, &st,
|
||||
AT_SYMLINK_NOFOLLOW);
|
||||
else
|
||||
statres = LXSTAT (_STAT_VER, name, &st);
|
||||
statres = LSTAT (name, &st);
|
||||
if (statres == 0 && S_ISLNK (st.st_mode))
|
||||
flag = FTW_SLN;
|
||||
else
|
||||
@ -476,7 +476,7 @@ process_entry (struct ftw_data *data, struct dir_data *dir, const char *name,
|
||||
|
||||
static int
|
||||
__attribute ((noinline))
|
||||
ftw_dir (struct ftw_data *data, struct STAT *st, struct dir_data *old_dir)
|
||||
ftw_dir (struct ftw_data *data, struct STRUCT_STAT *st, struct dir_data *old_dir)
|
||||
{
|
||||
struct dir_data dir;
|
||||
struct dirent64 *d;
|
||||
@ -630,7 +630,7 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors,
|
||||
int flags)
|
||||
{
|
||||
struct ftw_data data;
|
||||
struct STAT st;
|
||||
struct STRUCT_STAT st;
|
||||
int result = 0;
|
||||
int save_err;
|
||||
int cwdfd = -1;
|
||||
@ -740,12 +740,12 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors,
|
||||
name = data.dirbuf;
|
||||
|
||||
if (((flags & FTW_PHYS)
|
||||
? LXSTAT (_STAT_VER, name, &st)
|
||||
: XSTAT (_STAT_VER, name, &st)) < 0)
|
||||
? LSTAT (name, &st)
|
||||
: STAT (name, &st)) < 0)
|
||||
{
|
||||
if (!(flags & FTW_PHYS)
|
||||
&& errno == ENOENT
|
||||
&& LXSTAT (_STAT_VER, name, &st) == 0
|
||||
&& LSTAT (name, &st) == 0
|
||||
&& S_ISLNK (st.st_mode))
|
||||
result = (*data.func) (data.dirbuf, &st, data.cvt_arr[FTW_SLN],
|
||||
&data.ftw);
|
||||
|
@ -22,10 +22,10 @@
|
||||
#define NFTW_OLD_NAME __old_nftw64
|
||||
#define NFTW_NEW_NAME __new_nftw64
|
||||
#define INO_T ino64_t
|
||||
#define STAT stat64
|
||||
#define LXSTAT __lxstat64
|
||||
#define XSTAT __xstat64
|
||||
#define FXSTATAT __fxstatat64
|
||||
#define STRUCT_STAT stat64
|
||||
#define LSTAT __lstat64
|
||||
#define STAT __stat64
|
||||
#define FSTATAT __fstatat64
|
||||
#define FTW_FUNC_T __ftw64_func_t
|
||||
#define NFTW_FUNC_T __nftw64_func_t
|
||||
|
||||
|
@ -32,8 +32,8 @@ get_current_dir_name (void)
|
||||
|
||||
pwd = getenv ("PWD");
|
||||
if (pwd != NULL
|
||||
&& stat64 (".", &dotstat) == 0
|
||||
&& stat64 (pwd, &pwdstat) == 0
|
||||
&& __stat64 (".", &dotstat) == 0
|
||||
&& __stat64 (pwd, &pwdstat) == 0
|
||||
&& pwdstat.st_dev == dotstat.st_dev
|
||||
&& pwdstat.st_ino == dotstat.st_ino)
|
||||
/* The PWD value is correct. Use it. */
|
||||
|
@ -36,7 +36,7 @@ mkdirat (int fd, const char *path, mode_t mode)
|
||||
{
|
||||
/* Check FD is associated with a directory. */
|
||||
struct stat64 st;
|
||||
if (__fxstat64 (_STAT_VER, fd, &st) != 0)
|
||||
if (__fstat64 (fd, &st) != 0)
|
||||
return -1;
|
||||
|
||||
if (!S_ISDIR (st.st_mode))
|
||||
|
@ -37,7 +37,7 @@ mkfifoat (int fd, const char *path, mode_t mode)
|
||||
{
|
||||
/* Check FD is associated with a directory. */
|
||||
struct stat64 st;
|
||||
if (__fxstat64 (_STAT_VER, fd, &st) != 0)
|
||||
if (__fstat64 (fd, &st) != 0)
|
||||
return -1;
|
||||
|
||||
if (!S_ISDIR (st.st_mode))
|
||||
|
@ -42,7 +42,7 @@ __openat (int fd, const char *file, int oflag, ...)
|
||||
{
|
||||
/* Check FD is associated with a directory. */
|
||||
struct stat64 st;
|
||||
if (__fxstat64 (_STAT_VER, fd, &st) != 0)
|
||||
if (__fstat64 (fd, &st) != 0)
|
||||
return -1;
|
||||
|
||||
if (!S_ISDIR (st.st_mode))
|
||||
|
@ -40,7 +40,7 @@ __openat64 (int fd, const char *file, int oflag, ...)
|
||||
{
|
||||
/* Check FD is associated with a directory. */
|
||||
struct stat64 st;
|
||||
if (__fxstat64 (_STAT_VER, fd, &st) != 0)
|
||||
if (__fstat64 (fd, &st) != 0)
|
||||
return -1;
|
||||
|
||||
if (!S_ISDIR (st.st_mode))
|
||||
|
@ -44,7 +44,7 @@ __xmknodat (int vers, int fd, const char *path, mode_t mode, dev_t *dev)
|
||||
{
|
||||
/* Check FD is associated with a directory. */
|
||||
struct stat64 st;
|
||||
if (__fxstat64 (_STAT_VER, fd, &st) != 0)
|
||||
if (__fstat64 (fd, &st) != 0)
|
||||
return -1;
|
||||
|
||||
if (!S_ISDIR (st.st_mode))
|
||||
|
@ -1145,7 +1145,7 @@ libc_hidden_def (_IO_file_seek)
|
||||
int
|
||||
_IO_file_stat (FILE *fp, void *st)
|
||||
{
|
||||
return __fxstat64 (_STAT_VER, fp->_fileno, (struct stat64 *) st);
|
||||
return __fstat64 (fp->_fileno, (struct stat64 *) st);
|
||||
}
|
||||
libc_hidden_def (_IO_file_stat)
|
||||
|
||||
|
@ -207,7 +207,7 @@ _nl_load_locale_from_archive (int category, const char **namep)
|
||||
/* Cannot open the archive, for whatever reason. */
|
||||
return NULL;
|
||||
|
||||
if (__fxstat64 (_STAT_VER, fd, &archive_stat) == -1)
|
||||
if (__fstat64 (fd, &archive_stat) == -1)
|
||||
{
|
||||
/* stat failed, very strange. */
|
||||
close_and_out:
|
||||
@ -405,7 +405,7 @@ _nl_load_locale_from_archive (int category, const char **namep)
|
||||
/* Now verify we think this is really the same archive file
|
||||
we opened before. If it has been changed we cannot trust
|
||||
the header we read previously. */
|
||||
if (__fxstat64 (_STAT_VER, fd, &st) < 0
|
||||
if (__fstat64 (fd, &st) < 0
|
||||
|| st.st_size != archive_stat.st_size
|
||||
|| st.st_mtime != archive_stat.st_mtime
|
||||
|| st.st_dev != archive_stat.st_dev
|
||||
|
@ -180,7 +180,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
|
||||
/* Cannot open the file. */
|
||||
return;
|
||||
|
||||
if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) < 0)
|
||||
if (__builtin_expect (__fstat64 (fd, &st), 0) < 0)
|
||||
{
|
||||
puntfd:
|
||||
__close_nocancel_nostatus (fd);
|
||||
@ -206,7 +206,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
|
||||
if (__builtin_expect (fd, 0) < 0)
|
||||
return;
|
||||
|
||||
if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) < 0)
|
||||
if (__builtin_expect (__fstat64 (fd, &st), 0) < 0)
|
||||
goto puntfd;
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ daemon (int nochdir, int noclose)
|
||||
struct stat64 st;
|
||||
|
||||
if ((fd = __open_nocancel(_PATH_DEVNULL, O_RDWR, 0)) != -1
|
||||
&& (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0)
|
||||
&& (__builtin_expect (__fstat64 (fd, &st), 0)
|
||||
== 0)) {
|
||||
if (__builtin_expect (S_ISCHR (st.st_mode), 1) != 0
|
||||
#if defined DEV_NULL_MAJOR && defined DEV_NULL_MINOR
|
||||
|
@ -106,7 +106,7 @@ initshells (void)
|
||||
strings = NULL;
|
||||
if ((fp = fopen(_PATH_SHELLS, "rce")) == NULL)
|
||||
goto init_okshells_noclose;
|
||||
if (fstat64(fileno(fp), &statb) == -1) {
|
||||
if (__fstat64(fileno(fp), &statb) == -1) {
|
||||
init_okshells:
|
||||
(void)fclose(fp);
|
||||
init_okshells_noclose:
|
||||
|
@ -68,7 +68,7 @@ check_add_mapping (const char *name, size_t namelen, int fd, sem_t *existing)
|
||||
|
||||
/* Get the information about the file. */
|
||||
struct stat64 st;
|
||||
if (__fxstat64 (_STAT_VER, fd, &st) == 0)
|
||||
if (__fstat64 (fd, &st) == 0)
|
||||
{
|
||||
/* Get the lock. */
|
||||
lll_lock (__sem_mappings_lock, LLL_PRIVATE);
|
||||
|
@ -325,7 +325,7 @@ __nscd_get_mapping (request_type type, const char *key,
|
||||
if (__glibc_unlikely (n == keylen))
|
||||
{
|
||||
struct stat64 st;
|
||||
if (__builtin_expect (fstat64 (mapfd, &st) != 0, 0)
|
||||
if (__builtin_expect (__fstat64 (mapfd, &st) != 0, 0)
|
||||
|| __builtin_expect (st.st_size < sizeof (struct database_pers_head),
|
||||
0))
|
||||
goto out_close;
|
||||
|
@ -49,12 +49,6 @@
|
||||
# define readdir(str) __readdir64 (str)
|
||||
# define getpwnam_r(name, bufp, buf, len, res) \
|
||||
__getpwnam_r (name, bufp, buf, len, res)
|
||||
# ifndef __lstat64
|
||||
# define __lstat64(fname, buf) __lxstat64 (_STAT_VER, fname, buf)
|
||||
# endif
|
||||
# ifndef __stat64
|
||||
# define __stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf)
|
||||
# endif
|
||||
# define struct_stat64 struct stat64
|
||||
# define FLEXIBLE_ARRAY_MEMBER
|
||||
# include <shlib-compat.h>
|
||||
@ -63,7 +57,6 @@
|
||||
# define __getlogin_r(buf, len) getlogin_r (buf, len)
|
||||
# define __lstat64(fname, buf) lstat (fname, buf)
|
||||
# define __stat64(fname, buf) stat (fname, buf)
|
||||
# define __fxstatat64(_, d, f, st, flag) fstatat (d, f, st, flag)
|
||||
# define struct_stat64 struct stat
|
||||
# ifndef __MVS__
|
||||
# define __alloca alloca
|
||||
|
@ -158,7 +158,7 @@ __realpath (const char *name, char *resolved)
|
||||
dest = __mempcpy (dest, start, end - start);
|
||||
*dest = '\0';
|
||||
|
||||
if (__lxstat64 (_STAT_VER, rpath, &st) < 0)
|
||||
if (__lstat64 (rpath, &st) < 0)
|
||||
goto error;
|
||||
|
||||
if (S_ISLNK (st.st_mode))
|
||||
|
@ -32,7 +32,7 @@
|
||||
#undef stat
|
||||
#define stat stat64
|
||||
#undef __stat
|
||||
#define __stat(file, buf) __xstat64 (_STAT_VER, file, buf)
|
||||
#define __stat(file, buf) __stat64 (file, buf)
|
||||
|
||||
#define COMPILE_GLOB64 1
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
#undef stat
|
||||
#define stat stat64
|
||||
#undef __stat
|
||||
#define __stat(file, buf) __xstat64 (_STAT_VER, file, buf)
|
||||
#define __stat(file, buf) __stat64 (file, buf)
|
||||
|
||||
#define COMPILE_GLOB64 1
|
||||
|
||||
|
@ -63,7 +63,7 @@ __ptsname_internal (int fd, char *buf, size_t buflen, struct stat64 *stp)
|
||||
|
||||
if (stp)
|
||||
{
|
||||
if (__xstat64 (_STAT_VER, peername, stp) < 0)
|
||||
if (__stat64 (peername, stp) < 0)
|
||||
return errno;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ _dl_get_file_id (int fd, struct r_file_id *id)
|
||||
{
|
||||
struct stat64 st;
|
||||
|
||||
if (__glibc_unlikely (__fxstat64 (_STAT_VER, fd, &st) < 0))
|
||||
if (__glibc_unlikely (__fstat64 (fd, &st) < 0))
|
||||
return false;
|
||||
|
||||
id->dev = st.st_dev;
|
||||
|
@ -140,7 +140,7 @@ euidaccess (const char *path, int mode)
|
||||
return access (path, mode);
|
||||
#endif
|
||||
|
||||
if (stat64 (path, &stats))
|
||||
if (__stat64 (path, &stats))
|
||||
return -1;
|
||||
|
||||
mode &= (X_OK | W_OK | R_OK); /* Clear any bogus bits. */
|
||||
|
@ -29,7 +29,7 @@ __fdopendir (int fd)
|
||||
{
|
||||
struct stat64 statbuf;
|
||||
|
||||
if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &statbuf), 0) < 0)
|
||||
if (__builtin_expect (__fstat64 (fd, &statbuf), 0) < 0)
|
||||
return NULL;
|
||||
if (__glibc_unlikely (! S_ISDIR (statbuf.st_mode)))
|
||||
{
|
||||
|
@ -133,7 +133,7 @@ __fpathconf (int fd, int name)
|
||||
/* AIO is only allowed on regular files and block devices. */
|
||||
struct stat64 st;
|
||||
|
||||
if (__fxstat64 (_STAT_VER, fd, &st) < 0
|
||||
if (__fstat64 (fd, &st) < 0
|
||||
|| (! S_ISREG (st.st_mode) && ! S_ISBLK (st.st_mode)))
|
||||
return -1;
|
||||
else
|
||||
|
@ -1785,7 +1785,7 @@ gaiconf_init (void)
|
||||
if (fp != NULL)
|
||||
{
|
||||
struct stat64 st;
|
||||
if (__fxstat64 (_STAT_VER, fileno (fp), &st) != 0)
|
||||
if (__fstat64 (fileno (fp), &st) != 0)
|
||||
{
|
||||
fclose (fp);
|
||||
goto no_file;
|
||||
@ -2138,7 +2138,7 @@ static void
|
||||
gaiconf_reload (void)
|
||||
{
|
||||
struct stat64 st;
|
||||
if (__xstat64 (_STAT_VER, GAICONF_FNAME, &st) != 0
|
||||
if (stat64 (GAICONF_FNAME, &st) != 0
|
||||
|| !check_gaiconf_mtime (&st))
|
||||
gaiconf_init ();
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ isfdtype (int fildes, int fdtype)
|
||||
|
||||
{
|
||||
int save_error = errno;
|
||||
result = fstat64 (fildes, &st);
|
||||
result = __fstat64 (fildes, &st);
|
||||
__set_errno (save_error);
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ opendir_tail (int fd)
|
||||
`stat' call. The S_ISDIR check is superfluous if O_DIRECTORY works,
|
||||
but it's cheap and we need the stat call for st_blksize anyway. */
|
||||
struct stat64 statbuf;
|
||||
if (__glibc_unlikely (__fxstat64 (_STAT_VER, fd, &statbuf) < 0))
|
||||
if (__glibc_unlikely (__fstat64 (fd, &statbuf) < 0))
|
||||
goto lose;
|
||||
if (__glibc_unlikely (! S_ISDIR (statbuf.st_mode)))
|
||||
{
|
||||
|
@ -131,7 +131,7 @@ __pathconf (const char *path, int name)
|
||||
/* AIO is only allowed on regular files and block devices. */
|
||||
struct stat64 st;
|
||||
|
||||
if (__xstat64 (_STAT_VER, path, &st) < 0
|
||||
if (__stat64 (path, &st) < 0
|
||||
|| (! S_ISREG (st.st_mode) && ! S_ISBLK (st.st_mode)))
|
||||
return -1;
|
||||
else
|
||||
|
@ -48,7 +48,7 @@ posix_fallocate (int fd, __off_t offset, __off_t len)
|
||||
}
|
||||
|
||||
/* We have to make sure that this is really a regular file. */
|
||||
if (__fxstat64 (_STAT_VER, fd, &st) != 0)
|
||||
if (__fstat64 (fd, &st) != 0)
|
||||
return EBADF;
|
||||
if (S_ISFIFO (st.st_mode))
|
||||
return ESPIPE;
|
||||
|
@ -48,7 +48,7 @@ __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len)
|
||||
}
|
||||
|
||||
/* We have to make sure that this is really a regular file. */
|
||||
if (__fxstat64 (_STAT_VER, fd, &st) != 0)
|
||||
if (__fstat64 (fd, &st) != 0)
|
||||
return EBADF;
|
||||
if (S_ISFIFO (st.st_mode))
|
||||
return ESPIPE;
|
||||
|
@ -1216,7 +1216,7 @@ __sysconf_check_spec (const char *spec)
|
||||
spec, speclen + 1);
|
||||
|
||||
struct stat64 st;
|
||||
long int ret = __xstat64 (_STAT_VER, name, &st) >= 0 ? 1 : -1;
|
||||
long int ret = __stat64 (name, &st) >= 0 ? 1 : -1;
|
||||
|
||||
__set_errno (save_errno);
|
||||
return ret;
|
||||
|
@ -65,7 +65,6 @@
|
||||
# define __getpid getpid
|
||||
# define __mkdir mkdir
|
||||
# define __open open
|
||||
# define __lxstat64(version, file, buf) lstat (file, buf)
|
||||
# define __secure_getenv secure_getenv
|
||||
#endif
|
||||
|
||||
@ -96,7 +95,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
|
||||
@ -251,10 +250,10 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
|
||||
|
||||
case __GT_NOCREATE:
|
||||
/* This case is backward from the other three. __gen_tempname
|
||||
succeeds if __xstat fails because the name does not exist.
|
||||
succeeds if lstat fails because the name does not exist.
|
||||
Note the continue to bypass the common logic at the bottom
|
||||
of the loop. */
|
||||
if (__lxstat64 (_STAT_VER, tmpl, &st) < 0)
|
||||
if (__lstat64 (tmpl, &st) < 0)
|
||||
{
|
||||
if (errno == ENOENT)
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ faccessat (int fd, const char *file, int mode, int flag)
|
||||
return INLINE_SYSCALL (faccessat, 3, fd, file, mode);
|
||||
|
||||
struct stat64 stats;
|
||||
if (__fxstatat64 (_STAT_VER, fd, file, &stats, flag & AT_SYMLINK_NOFOLLOW))
|
||||
if (__fstatat64 (fd, file, &stats, flag & AT_SYMLINK_NOFOLLOW))
|
||||
return -1;
|
||||
|
||||
mode &= (X_OK | W_OK | R_OK); /* Clear any bogus bits. */
|
||||
|
@ -60,8 +60,8 @@ fexecve (int fd, char *const argv[], char *const envp[])
|
||||
|
||||
/* We come here only if the 'execve' call fails. Determine whether
|
||||
/proc is mounted. If not we return ENOSYS. */
|
||||
struct stat st;
|
||||
if (stat ("/proc/self/fd", &st) != 0 && errno == ENOENT)
|
||||
struct stat64 st;
|
||||
if (__stat64 ("/proc/self/fd", &st) != 0 && errno == ENOENT)
|
||||
save = ENOSYS;
|
||||
|
||||
__set_errno (save);
|
||||
|
@ -31,7 +31,7 @@ libc_hidden_proto (__old_glob64);
|
||||
#undef stat
|
||||
#define stat stat64
|
||||
#undef __stat
|
||||
#define __stat(file, buf) __xstat64 (_STAT_VER, file, buf)
|
||||
#define __stat(file, buf) __stat64 (file, buf)
|
||||
|
||||
/* Avoid calling gl_lstat with GLOB_ALTDIRFUNC. */
|
||||
#define GLOB_NO_LSTAT
|
||||
|
@ -67,7 +67,7 @@ distinguish_extX (const struct statfs *fsbuf, const char *file, int fd)
|
||||
char path[PATH_MAX];
|
||||
struct stat64 st;
|
||||
|
||||
if ((file == NULL ? fstat64 (fd, &st) : stat64 (file, &st)) != 0)
|
||||
if ((file == NULL ? __fstat64 (fd, &st) : __stat64 (file, &st)) != 0)
|
||||
/* Strange. The statfd call worked, but stat fails. Default to
|
||||
the more pessimistic value. */
|
||||
return EXT2_LINK_MAX;
|
||||
@ -110,7 +110,7 @@ distinguish_extX (const struct statfs *fsbuf, const char *file, int fd)
|
||||
continue;
|
||||
|
||||
struct stat64 fsst;
|
||||
if (stat64 (mntbuf.mnt_dir, &fsst) >= 0
|
||||
if (__stat64 (mntbuf.mnt_dir, &fsst) >= 0
|
||||
&& st.st_dev == fsst.st_dev)
|
||||
{
|
||||
if (strcmp (mntbuf.mnt_type, "ext4") == 0)
|
||||
|
@ -114,7 +114,7 @@ __ptsname_internal (int fd, char *buf, size_t buflen, struct stat64 *stp)
|
||||
return ERANGE;
|
||||
}
|
||||
|
||||
if (__fxstat64 (_STAT_VER, fd, stp) < 0)
|
||||
if (__fstat64 (fd, stp) < 0)
|
||||
return errno;
|
||||
|
||||
/* Check if FD really is a master pseudo terminal. */
|
||||
@ -138,7 +138,7 @@ __ptsname_internal (int fd, char *buf, size_t buflen, struct stat64 *stp)
|
||||
p[2] = '\0';
|
||||
}
|
||||
|
||||
if (__xstat64 (_STAT_VER, buf, stp) < 0)
|
||||
if (__stat64 (buf, stp) < 0)
|
||||
return errno;
|
||||
|
||||
/* Check if the name we're about to return really corresponds to a
|
||||
|
@ -84,7 +84,7 @@ getttyname (const char *dev, const struct stat64 *mytty, int save, int *dostat)
|
||||
*((char *) __mempcpy (getttyname_name, dev, devlen - 1)) = '/';
|
||||
}
|
||||
memcpy (&getttyname_name[devlen], d->d_name, dlen);
|
||||
if (__xstat64 (_STAT_VER, getttyname_name, &st) == 0
|
||||
if (__stat64 (getttyname_name, &st) == 0
|
||||
&& is_mytty (mytty, &st))
|
||||
{
|
||||
(void) __closedir (dirstream);
|
||||
@ -125,7 +125,7 @@ ttyname (int fd)
|
||||
if (__glibc_unlikely (__tcgetattr (fd, &term) < 0))
|
||||
return NULL;
|
||||
|
||||
if (__fxstat64 (_STAT_VER, fd, &st) < 0)
|
||||
if (__fstat64 (fd, &st) < 0)
|
||||
return NULL;
|
||||
|
||||
/* We try using the /proc filesystem. */
|
||||
@ -162,14 +162,14 @@ ttyname (int fd)
|
||||
|
||||
/* Verify readlink result, fall back on iterating through devices. */
|
||||
if (ttyname_buf[0] == '/'
|
||||
&& __xstat64 (_STAT_VER, ttyname_buf, &st1) == 0
|
||||
&& __stat64 (ttyname_buf, &st1) == 0
|
||||
&& is_mytty (&st, &st1))
|
||||
return ttyname_buf;
|
||||
|
||||
doispty = 1;
|
||||
}
|
||||
|
||||
if (__xstat64 (_STAT_VER, "/dev/pts", &st1) == 0 && S_ISDIR (st1.st_mode))
|
||||
if (__stat64 ("/dev/pts", &st1) == 0 && S_ISDIR (st1.st_mode))
|
||||
{
|
||||
name = getttyname ("/dev/pts", &st, save, &dostat);
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ getttyname_r (char *buf, size_t buflen, const struct stat64 *mytty,
|
||||
cp = __stpncpy (buf + devlen, d->d_name, needed);
|
||||
cp[0] = '\0';
|
||||
|
||||
if (__xstat64 (_STAT_VER, buf, &st) == 0
|
||||
if (__stat64 (buf, &st) == 0
|
||||
&& is_mytty (mytty, &st))
|
||||
{
|
||||
(void) __closedir (dirstream);
|
||||
@ -118,7 +118,7 @@ __ttyname_r (int fd, char *buf, size_t buflen)
|
||||
if (__glibc_unlikely (__tcgetattr (fd, &term) < 0))
|
||||
return errno;
|
||||
|
||||
if (__fxstat64 (_STAT_VER, fd, &st) < 0)
|
||||
if (__fstat64 (fd, &st) < 0)
|
||||
return errno;
|
||||
|
||||
/* We try using the /proc filesystem. */
|
||||
@ -146,7 +146,7 @@ __ttyname_r (int fd, char *buf, size_t buflen)
|
||||
|
||||
/* Verify readlink result, fall back on iterating through devices. */
|
||||
if (buf[0] == '/'
|
||||
&& __xstat64 (_STAT_VER, buf, &st1) == 0
|
||||
&& __stat64 (buf, &st1) == 0
|
||||
&& is_mytty (&st, &st1))
|
||||
return 0;
|
||||
|
||||
@ -157,7 +157,7 @@ __ttyname_r (int fd, char *buf, size_t buflen)
|
||||
memcpy (buf, "/dev/pts/", sizeof ("/dev/pts/"));
|
||||
buflen -= sizeof ("/dev/pts/") - 1;
|
||||
|
||||
if (__xstat64 (_STAT_VER, buf, &st1) == 0 && S_ISDIR (st1.st_mode))
|
||||
if (__stat64 (buf, &st1) == 0 && S_ISDIR (st1.st_mode))
|
||||
{
|
||||
ret = getttyname_r (buf, buflen, &st, save,
|
||||
&dostat);
|
||||
|
@ -25,7 +25,7 @@ ftok (const char *pathname, int proj_id)
|
||||
struct stat64 st;
|
||||
key_t key;
|
||||
|
||||
if (__xstat64 (_STAT_VER, pathname, &st) < 0)
|
||||
if (__stat64 (pathname, &st) < 0)
|
||||
return (key_t) -1;
|
||||
|
||||
key = ((st.st_ino & 0xffff) | ((st.st_dev & 0xff) << 16)
|
||||
|
@ -121,7 +121,7 @@ __getdate_r (const char *string, struct tm *tp)
|
||||
if (datemsk == NULL || *datemsk == '\0')
|
||||
return 1;
|
||||
|
||||
if (stat64 (datemsk, &st) < 0)
|
||||
if (__stat64 (datemsk, &st) < 0)
|
||||
return 3;
|
||||
|
||||
if (!S_ISREG (st.st_mode))
|
||||
|
@ -152,7 +152,7 @@ __tzfile_read (const char *file, size_t extra, char **extrap)
|
||||
/* If we were already using tzfile, check whether the file changed. */
|
||||
struct stat64 st;
|
||||
if (was_using_tzfile
|
||||
&& stat64 (file, &st) == 0
|
||||
&& __stat64 (file, &st) == 0
|
||||
&& tzfile_ino == st.st_ino && tzfile_dev == st.st_dev
|
||||
&& tzfile_mtime == st.st_mtime)
|
||||
goto done; /* Nothing to do. */
|
||||
@ -164,7 +164,7 @@ __tzfile_read (const char *file, size_t extra, char **extrap)
|
||||
goto ret_free_transitions;
|
||||
|
||||
/* Get information about the file we are actually using. */
|
||||
if (fstat64 (__fileno (f), &st) != 0)
|
||||
if (__fstat64 (__fileno (f), &st) != 0)
|
||||
goto lose;
|
||||
|
||||
free ((void *) transitions);
|
||||
|
Loading…
Reference in New Issue
Block a user