mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-21 20:40:05 +00:00
Use 64 bit time_t stat internally
For the legacy ABI with supports 32-bit time_t it calls the 64-bit time directly, since the LFS symbols calls the 64-bit time_t ones internally. Checked on i686-linux-gnu and x86_64-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
This commit is contained in:
parent
a318262bc0
commit
52a5fe70a2
@ -69,10 +69,10 @@ check_one_fd (int fd, int mode)
|
|||||||
Note that the following code assumes that STDIN_FILENO,
|
Note that the following code assumes that STDIN_FILENO,
|
||||||
STDOUT_FILENO, STDERR_FILENO are the three lowest file
|
STDOUT_FILENO, STDERR_FILENO are the three lowest file
|
||||||
decsriptor numbers, in this order. */
|
decsriptor numbers, in this order. */
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
if (__builtin_expect (nullfd != fd, 0)
|
if (__glibc_unlikely (nullfd != fd)
|
||||||
|| __builtin_expect (__fstat64 (fd, &st), 0) != 0
|
|| __glibc_likely (__fstat64_time64 (fd, &st) != 0)
|
||||||
|| __builtin_expect (S_ISCHR (st.st_mode), 1) == 0
|
|| __glibc_unlikely (S_ISCHR (st.st_mode) == 0)
|
||||||
|| st.st_rdev != dev)
|
|| st.st_rdev != dev)
|
||||||
/* We cannot even give an error message here since it would
|
/* We cannot even give an error message here since it would
|
||||||
run into the same problems. */
|
run into the same problems. */
|
||||||
|
@ -1946,11 +1946,11 @@ open_path (const char *name, size_t namelen, int mode,
|
|||||||
{
|
{
|
||||||
/* We failed to open machine dependent library. Let's
|
/* We failed to open machine dependent library. Let's
|
||||||
test whether there is any directory at all. */
|
test whether there is any directory at all. */
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
|
|
||||||
buf[buflen - namelen - 1] = '\0';
|
buf[buflen - namelen - 1] = '\0';
|
||||||
|
|
||||||
if (__stat64 (buf, &st) != 0
|
if (__stat64_time64 (buf, &st) != 0
|
||||||
|| ! S_ISDIR (st.st_mode))
|
|| ! S_ISDIR (st.st_mode))
|
||||||
/* The directory does not exist or it is no directory. */
|
/* The directory does not exist or it is no directory. */
|
||||||
this_dir->status[cnt] = nonexisting;
|
this_dir->status[cnt] = nonexisting;
|
||||||
@ -1968,9 +1968,9 @@ open_path (const char *name, size_t namelen, int mode,
|
|||||||
/* This is an extra security effort to make sure nobody can
|
/* This is an extra security effort to make sure nobody can
|
||||||
preload broken shared objects which are in the trusted
|
preload broken shared objects which are in the trusted
|
||||||
directories and so exploit the bugs. */
|
directories and so exploit the bugs. */
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
|
|
||||||
if (__fstat64 (fd, &st) != 0
|
if (__fstat64_time64 (fd, &st) != 0
|
||||||
|| (st.st_mode & S_ISUID) == 0)
|
|| (st.st_mode & S_ISUID) == 0)
|
||||||
{
|
{
|
||||||
/* The shared object cannot be tested for being SUID
|
/* The shared object cannot be tested for being SUID
|
||||||
|
@ -43,11 +43,11 @@ void *
|
|||||||
_dl_sysdep_read_whole_file (const char *file, size_t *sizep, int prot)
|
_dl_sysdep_read_whole_file (const char *file, size_t *sizep, int prot)
|
||||||
{
|
{
|
||||||
void *result = MAP_FAILED;
|
void *result = MAP_FAILED;
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
int fd = __open64_nocancel (file, O_RDONLY | O_CLOEXEC);
|
int fd = __open64_nocancel (file, O_RDONLY | O_CLOEXEC);
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
{
|
{
|
||||||
if (__fstat64 (fd, &st) >= 0)
|
if (__fstat64_time64 (fd, &st) >= 0)
|
||||||
{
|
{
|
||||||
*sizep = st.st_size;
|
*sizep = st.st_size;
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ _dl_start_profile (void)
|
|||||||
{
|
{
|
||||||
char *filename;
|
char *filename;
|
||||||
int fd;
|
int fd;
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
const ElfW(Phdr) *ph;
|
const ElfW(Phdr) *ph;
|
||||||
ElfW(Addr) mapstart = ~((ElfW(Addr)) 0);
|
ElfW(Addr) mapstart = ~((ElfW(Addr)) 0);
|
||||||
ElfW(Addr) mapend = 0;
|
ElfW(Addr) mapend = 0;
|
||||||
@ -342,7 +342,7 @@ _dl_start_profile (void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (__fstat64 (fd, &st) < 0 || !S_ISREG (st.st_mode))
|
if (__fstat64_time64 (fd, &st) < 0 || !S_ISREG (st.st_mode))
|
||||||
{
|
{
|
||||||
/* Not stat'able or not a regular file => don't use it. */
|
/* Not stat'able or not a regular file => don't use it. */
|
||||||
errstr = "%s: cannot stat file: %s\n";
|
errstr = "%s: cannot stat file: %s\n";
|
||||||
|
@ -48,7 +48,7 @@ int
|
|||||||
__gconv_load_cache (void)
|
__gconv_load_cache (void)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
struct gconvcache_header *header;
|
struct gconvcache_header *header;
|
||||||
|
|
||||||
/* We cannot use the cache if the GCONV_PATH environment variable is
|
/* We cannot use the cache if the GCONV_PATH environment variable is
|
||||||
@ -64,7 +64,7 @@ __gconv_load_cache (void)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* Get information about the file. */
|
/* Get information about the file. */
|
||||||
if (__builtin_expect (__fstat64 (fd, &st), 0) < 0
|
if (__glibc_unlikely (__fstat64_time64 (fd, &st) < 0)
|
||||||
/* We do not have to start looking at the file if it cannot contain
|
/* We do not have to start looking at the file if it cannot contain
|
||||||
at least the cache header. */
|
at least the cache header. */
|
||||||
|| (size_t) st.st_size < sizeof (struct gconvcache_header))
|
|| (size_t) st.st_size < sizeof (struct gconvcache_header))
|
||||||
|
@ -49,7 +49,7 @@ extern int __versionsort64 (const struct dirent64 **a,
|
|||||||
const struct dirent64 **b)
|
const struct dirent64 **b)
|
||||||
__attribute_pure__;
|
__attribute_pure__;
|
||||||
extern DIR *__alloc_dir (int fd, bool close_fd, int flags,
|
extern DIR *__alloc_dir (int fd, bool close_fd, int flags,
|
||||||
const struct stat64 *statp)
|
const struct __stat64_t64 *statp)
|
||||||
__nonnull (4) attribute_hidden;
|
__nonnull (4) attribute_hidden;
|
||||||
extern __typeof (rewinddir) __rewinddir;
|
extern __typeof (rewinddir) __rewinddir;
|
||||||
extern __typeof (seekdir) __seekdir;
|
extern __typeof (seekdir) __seekdir;
|
||||||
|
@ -33,8 +33,8 @@ struct file_change_detection
|
|||||||
off64_t size;
|
off64_t size;
|
||||||
|
|
||||||
ino64_t ino;
|
ino64_t ino;
|
||||||
struct timespec mtime;
|
struct __timespec64 mtime;
|
||||||
struct timespec ctime;
|
struct __timespec64 ctime;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Returns true if *LEFT and *RIGHT describe the same version of the
|
/* Returns true if *LEFT and *RIGHT describe the same version of the
|
||||||
@ -45,7 +45,7 @@ bool __file_is_unchanged (const struct file_change_detection *left,
|
|||||||
/* Extract file change information to *FILE from the stat buffer
|
/* Extract file change information to *FILE from the stat buffer
|
||||||
*ST. */
|
*ST. */
|
||||||
void __file_change_detection_for_stat (struct file_change_detection *file,
|
void __file_change_detection_for_stat (struct file_change_detection *file,
|
||||||
const struct stat64 *st);
|
const struct __stat64_t64 *st);
|
||||||
|
|
||||||
/* Writes file change information for PATH to *FILE. Returns true on
|
/* Writes file change information for PATH to *FILE. Returns true on
|
||||||
success. For benign errors, *FILE is cleared, and true is
|
success. For benign errors, *FILE is cleared, and true is
|
||||||
|
@ -468,14 +468,14 @@ ruserok (const char *rhost, int superuser, const char *ruser,
|
|||||||
static FILE *
|
static FILE *
|
||||||
iruserfopen (const char *file, uid_t okuser)
|
iruserfopen (const char *file, uid_t okuser)
|
||||||
{
|
{
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
char *cp = NULL;
|
char *cp = NULL;
|
||||||
FILE *res = NULL;
|
FILE *res = NULL;
|
||||||
|
|
||||||
/* If not a regular file, if owned by someone other than user or
|
/* If not a regular file, if owned by someone other than user or
|
||||||
root, if writeable by anyone but the owner, or if hardlinked
|
root, if writeable by anyone but the owner, or if hardlinked
|
||||||
anywhere, quit. */
|
anywhere, quit. */
|
||||||
if (__lstat64 (file, &st))
|
if (__lstat64_time64 (file, &st))
|
||||||
cp = _("lstat failed");
|
cp = _("lstat failed");
|
||||||
else if (!S_ISREG (st.st_mode))
|
else if (!S_ISREG (st.st_mode))
|
||||||
cp = _("not regular file");
|
cp = _("not regular file");
|
||||||
@ -484,7 +484,7 @@ iruserfopen (const char *file, uid_t okuser)
|
|||||||
res = fopen (file, "rce");
|
res = fopen (file, "rce");
|
||||||
if (!res)
|
if (!res)
|
||||||
cp = _("cannot open");
|
cp = _("cannot open");
|
||||||
else if (__fstat64 (fileno (res), &st) < 0)
|
else if (__fstat64_time64 (fileno (res), &st) < 0)
|
||||||
cp = _("fstat failed");
|
cp = _("fstat failed");
|
||||||
else if (st.st_uid && st.st_uid != okuser)
|
else if (st.st_uid && st.st_uid != okuser)
|
||||||
cp = _("bad owner");
|
cp = _("bad owner");
|
||||||
|
@ -756,7 +756,7 @@ _nl_load_domain (struct loaded_l10nfile *domain_file,
|
|||||||
int fd = -1;
|
int fd = -1;
|
||||||
size_t size;
|
size_t size;
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
#else
|
#else
|
||||||
struct stat st;
|
struct stat st;
|
||||||
#endif
|
#endif
|
||||||
@ -804,7 +804,7 @@ _nl_load_domain (struct loaded_l10nfile *domain_file,
|
|||||||
/* We must know about the size of the file. */
|
/* We must know about the size of the file. */
|
||||||
if (
|
if (
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
__builtin_expect (__fstat64 (fd, &st) != 0, 0)
|
__glibc_unlikely (__fstat64_time64 (fd, &st) != 0)
|
||||||
#else
|
#else
|
||||||
__builtin_expect (fstat (fd, &st) != 0, 0)
|
__builtin_expect (fstat (fd, &st) != 0, 0)
|
||||||
#endif
|
#endif
|
||||||
|
@ -69,7 +69,7 @@ tests := test-utime test-stat test-stat2 test-lfs tst-getcwd \
|
|||||||
tst-posix_fallocate tst-posix_fallocate64 \
|
tst-posix_fallocate tst-posix_fallocate64 \
|
||||||
tst-fts tst-fts-lfs tst-open-tmpfile \
|
tst-fts tst-fts-lfs tst-open-tmpfile \
|
||||||
tst-copy_file_range tst-getcwd-abspath tst-lockf \
|
tst-copy_file_range tst-getcwd-abspath tst-lockf \
|
||||||
tst-ftw-lnk tst-file_change_detection tst-lchmod \
|
tst-ftw-lnk tst-lchmod \
|
||||||
tst-ftw-bz26353 tst-stat tst-stat-lfs \
|
tst-ftw-bz26353 tst-stat tst-stat-lfs \
|
||||||
tst-utime \
|
tst-utime \
|
||||||
tst-utimes \
|
tst-utimes \
|
||||||
@ -90,7 +90,7 @@ tests-time64 := \
|
|||||||
tst-utimes-time64 \
|
tst-utimes-time64 \
|
||||||
|
|
||||||
# Likewise for statx, but we do not need static linking here.
|
# Likewise for statx, but we do not need static linking here.
|
||||||
tests-internal += tst-statx
|
tests-internal += tst-statx tst-file_change_detection
|
||||||
tests-static += tst-statx
|
tests-static += tst-statx
|
||||||
|
|
||||||
ifeq ($(run-built-tests),yes)
|
ifeq ($(run-built-tests),yes)
|
||||||
|
@ -44,7 +44,7 @@ libc_hidden_def (__file_is_unchanged)
|
|||||||
|
|
||||||
void
|
void
|
||||||
__file_change_detection_for_stat (struct file_change_detection *file,
|
__file_change_detection_for_stat (struct file_change_detection *file,
|
||||||
const struct stat64 *st)
|
const struct __stat64_t64 *st)
|
||||||
{
|
{
|
||||||
if (S_ISDIR (st->st_mode))
|
if (S_ISDIR (st->st_mode))
|
||||||
/* Treat as empty file. */
|
/* Treat as empty file. */
|
||||||
@ -66,8 +66,8 @@ bool
|
|||||||
__file_change_detection_for_path (struct file_change_detection *file,
|
__file_change_detection_for_path (struct file_change_detection *file,
|
||||||
const char *path)
|
const char *path)
|
||||||
{
|
{
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
if (__stat64 (path, &st) != 0)
|
if (__stat64_time64 (path, &st) != 0)
|
||||||
switch (errno)
|
switch (errno)
|
||||||
{
|
{
|
||||||
case EACCES:
|
case EACCES:
|
||||||
@ -104,8 +104,8 @@ __file_change_detection_for_fp (struct file_change_detection *file,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
if (__fstat64 (__fileno (fp), &st) != 0)
|
if (__fstat64_time64 (__fileno (fp), &st) != 0)
|
||||||
/* If we already have a file descriptor, all errors are fatal. */
|
/* If we already have a file descriptor, all errors are fatal. */
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
|
@ -28,12 +28,12 @@ char *
|
|||||||
get_current_dir_name (void)
|
get_current_dir_name (void)
|
||||||
{
|
{
|
||||||
char *pwd;
|
char *pwd;
|
||||||
struct stat64 dotstat, pwdstat;
|
struct __stat64_t64 dotstat, pwdstat;
|
||||||
|
|
||||||
pwd = getenv ("PWD");
|
pwd = getenv ("PWD");
|
||||||
if (pwd != NULL
|
if (pwd != NULL
|
||||||
&& __stat64 (".", &dotstat) == 0
|
&& __stat64_time64 (".", &dotstat) == 0
|
||||||
&& __stat64 (pwd, &pwdstat) == 0
|
&& __stat64_time64 (pwd, &pwdstat) == 0
|
||||||
&& pwdstat.st_dev == dotstat.st_dev
|
&& pwdstat.st_dev == dotstat.st_dev
|
||||||
&& pwdstat.st_ino == dotstat.st_ino)
|
&& pwdstat.st_ino == dotstat.st_ino)
|
||||||
/* The PWD value is correct. Use it. */
|
/* The PWD value is correct. Use it. */
|
||||||
|
@ -78,7 +78,7 @@ _IO_file_doallocate (FILE *fp)
|
|||||||
{
|
{
|
||||||
size_t size;
|
size_t size;
|
||||||
char *p;
|
char *p;
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
|
|
||||||
size = BUFSIZ;
|
size = BUFSIZ;
|
||||||
if (fp->_fileno >= 0 && __builtin_expect (_IO_SYSSTAT (fp, &st), 0) >= 0)
|
if (fp->_fileno >= 0 && __builtin_expect (_IO_SYSSTAT (fp, &st), 0) >= 0)
|
||||||
|
@ -545,7 +545,7 @@ libc_hidden_ver (_IO_new_file_underflow, _IO_file_underflow)
|
|||||||
static int
|
static int
|
||||||
mmap_remap_check (FILE *fp)
|
mmap_remap_check (FILE *fp)
|
||||||
{
|
{
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
|
|
||||||
if (_IO_SYSSTAT (fp, &st) == 0
|
if (_IO_SYSSTAT (fp, &st) == 0
|
||||||
&& S_ISREG (st.st_mode) && st.st_size != 0
|
&& S_ISREG (st.st_mode) && st.st_size != 0
|
||||||
@ -663,7 +663,7 @@ decide_maybe_mmap (FILE *fp)
|
|||||||
file descriptors are for mmap-able objects and on 32-bit
|
file descriptors are for mmap-able objects and on 32-bit
|
||||||
machines we don't want to map files which are too large since
|
machines we don't want to map files which are too large since
|
||||||
this would require too much virtual memory. */
|
this would require too much virtual memory. */
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
|
|
||||||
if (_IO_SYSSTAT (fp, &st) == 0
|
if (_IO_SYSSTAT (fp, &st) == 0
|
||||||
&& S_ISREG (st.st_mode) && st.st_size != 0
|
&& S_ISREG (st.st_mode) && st.st_size != 0
|
||||||
@ -962,7 +962,7 @@ _IO_new_file_seekoff (FILE *fp, off64_t offset, int dir, int mode)
|
|||||||
break;
|
break;
|
||||||
case _IO_seek_end:
|
case _IO_seek_end:
|
||||||
{
|
{
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
if (_IO_SYSSTAT (fp, &st) == 0 && S_ISREG (st.st_mode))
|
if (_IO_SYSSTAT (fp, &st) == 0 && S_ISREG (st.st_mode))
|
||||||
{
|
{
|
||||||
offset += st.st_size;
|
offset += st.st_size;
|
||||||
@ -1145,7 +1145,7 @@ libc_hidden_def (_IO_file_seek)
|
|||||||
int
|
int
|
||||||
_IO_file_stat (FILE *fp, void *st)
|
_IO_file_stat (FILE *fp, void *st)
|
||||||
{
|
{
|
||||||
return __fstat64 (fp->_fileno, (struct stat64 *) st);
|
return __fstat64_time64 (fp->_fileno, (struct __stat64_t64 *) st);
|
||||||
}
|
}
|
||||||
libc_hidden_def (_IO_file_stat)
|
libc_hidden_def (_IO_file_stat)
|
||||||
|
|
||||||
|
@ -487,7 +487,7 @@ _IO_old_file_seekoff (FILE *fp, off64_t offset, int dir, int mode)
|
|||||||
break;
|
break;
|
||||||
case _IO_seek_end:
|
case _IO_seek_end:
|
||||||
{
|
{
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
if (_IO_SYSSTAT (fp, &st) == 0 && S_ISREG (st.st_mode))
|
if (_IO_SYSSTAT (fp, &st) == 0 && S_ISREG (st.st_mode))
|
||||||
{
|
{
|
||||||
offset += st.st_size;
|
offset += st.st_size;
|
||||||
|
@ -840,7 +840,7 @@ _IO_wfile_seekoff (FILE *fp, off64_t offset, int dir, int mode)
|
|||||||
break;
|
break;
|
||||||
case _IO_seek_end:
|
case _IO_seek_end:
|
||||||
{
|
{
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
if (_IO_SYSSTAT (fp, &st) == 0 && S_ISREG (st.st_mode))
|
if (_IO_SYSSTAT (fp, &st) == 0 && S_ISREG (st.st_mode))
|
||||||
{
|
{
|
||||||
offset += st.st_size;
|
offset += st.st_size;
|
||||||
|
@ -78,7 +78,7 @@ static struct archmapped *archmapped;
|
|||||||
ARCHMAPPED points to this; if mapping the archive header failed,
|
ARCHMAPPED points to this; if mapping the archive header failed,
|
||||||
then headmap.ptr is null. */
|
then headmap.ptr is null. */
|
||||||
static struct archmapped headmap;
|
static struct archmapped headmap;
|
||||||
static struct stat64 archive_stat; /* stat of archive when header mapped. */
|
static struct __stat64_t64 archive_stat; /* stat of archive when header mapped. */
|
||||||
|
|
||||||
/* Record of locales that we have already loaded from the archive. */
|
/* Record of locales that we have already loaded from the archive. */
|
||||||
struct locale_in_archive
|
struct locale_in_archive
|
||||||
@ -207,7 +207,7 @@ _nl_load_locale_from_archive (int category, const char **namep)
|
|||||||
/* Cannot open the archive, for whatever reason. */
|
/* Cannot open the archive, for whatever reason. */
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (__fstat64 (fd, &archive_stat) == -1)
|
if (__fstat64_time64 (fd, &archive_stat) == -1)
|
||||||
{
|
{
|
||||||
/* stat failed, very strange. */
|
/* stat failed, very strange. */
|
||||||
close_and_out:
|
close_and_out:
|
||||||
@ -396,7 +396,7 @@ _nl_load_locale_from_archive (int category, const char **namep)
|
|||||||
/* Open the file if it hasn't happened yet. */
|
/* Open the file if it hasn't happened yet. */
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
{
|
{
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
fd = __open_nocancel (archfname,
|
fd = __open_nocancel (archfname,
|
||||||
O_RDONLY|O_LARGEFILE|O_CLOEXEC);
|
O_RDONLY|O_LARGEFILE|O_CLOEXEC);
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
@ -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
|
/* Now verify we think this is really the same archive file
|
||||||
we opened before. If it has been changed we cannot trust
|
we opened before. If it has been changed we cannot trust
|
||||||
the header we read previously. */
|
the header we read previously. */
|
||||||
if (__fstat64 (fd, &st) < 0
|
if (__fstat64_time64 (fd, &st) < 0
|
||||||
|| st.st_size != archive_stat.st_size
|
|| st.st_size != archive_stat.st_size
|
||||||
|| st.st_mtime != archive_stat.st_mtime
|
|| st.st_mtime != archive_stat.st_mtime
|
||||||
|| st.st_dev != archive_stat.st_dev
|
|| st.st_dev != archive_stat.st_dev
|
||||||
|
@ -167,7 +167,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
|
|||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
void *filedata;
|
void *filedata;
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
struct __locale_data *newdata;
|
struct __locale_data *newdata;
|
||||||
int save_err;
|
int save_err;
|
||||||
int alloc = ld_mapped;
|
int alloc = ld_mapped;
|
||||||
@ -180,7 +180,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
|
|||||||
/* Cannot open the file. */
|
/* Cannot open the file. */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (__builtin_expect (__fstat64 (fd, &st), 0) < 0)
|
if (__glibc_unlikely (__fstat64_time64 (fd, &st) < 0))
|
||||||
{
|
{
|
||||||
puntfd:
|
puntfd:
|
||||||
__close_nocancel_nostatus (fd);
|
__close_nocancel_nostatus (fd);
|
||||||
@ -206,7 +206,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
|
|||||||
if (__builtin_expect (fd, 0) < 0)
|
if (__builtin_expect (fd, 0) < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (__builtin_expect (__fstat64 (fd, &st), 0) < 0)
|
if (__glibc_unlikely (__fstat64_time64 (fd, &st) < 0))
|
||||||
goto puntfd;
|
goto puntfd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,8 +324,8 @@ __nscd_get_mapping (request_type type, const char *key,
|
|||||||
|
|
||||||
if (__glibc_unlikely (n == keylen))
|
if (__glibc_unlikely (n == keylen))
|
||||||
{
|
{
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
if (__builtin_expect (__fstat64 (mapfd, &st) != 0, 0)
|
if (__glibc_unlikely (__fstat64_time64 (mapfd, &st) != 0)
|
||||||
|| __builtin_expect (st.st_size < sizeof (struct database_pers_head),
|
|| __builtin_expect (st.st_size < sizeof (struct database_pers_head),
|
||||||
0))
|
0))
|
||||||
goto out_close;
|
goto out_close;
|
||||||
|
@ -394,7 +394,7 @@ nss_database_check_reload_and_get (struct nss_database_state *local,
|
|||||||
nss_action_list *result,
|
nss_action_list *result,
|
||||||
enum nss_database database_index)
|
enum nss_database database_index)
|
||||||
{
|
{
|
||||||
struct stat64 str;
|
struct __stat64_t64 str;
|
||||||
|
|
||||||
/* Acquire MO is needed because the thread that sets reload_disabled
|
/* Acquire MO is needed because the thread that sets reload_disabled
|
||||||
may have loaded the configuration first, so synchronize with the
|
may have loaded the configuration first, so synchronize with the
|
||||||
@ -424,7 +424,7 @@ nss_database_check_reload_and_get (struct nss_database_state *local,
|
|||||||
errors here are very unlikely, but the chance that we're entering
|
errors here are very unlikely, but the chance that we're entering
|
||||||
a container is also very unlikely, so we err on the side of both
|
a container is also very unlikely, so we err on the side of both
|
||||||
very unlikely things not happening at the same time. */
|
very unlikely things not happening at the same time. */
|
||||||
if (__stat64 ("/", &str) != 0
|
if (__stat64_time64 ("/", &str) != 0
|
||||||
|| (local->root_ino != 0
|
|| (local->root_ino != 0
|
||||||
&& (str.st_ino != local->root_ino
|
&& (str.st_ino != local->root_ino
|
||||||
|| str.st_dev != local->root_dev)))
|
|| str.st_dev != local->root_dev)))
|
||||||
|
@ -32,9 +32,9 @@ struct r_file_id
|
|||||||
static inline bool
|
static inline bool
|
||||||
_dl_get_file_id (int fd, struct r_file_id *id)
|
_dl_get_file_id (int fd, struct r_file_id *id)
|
||||||
{
|
{
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
|
|
||||||
if (__glibc_unlikely (__fstat64 (fd, &st) < 0))
|
if (__glibc_unlikely (__fstat64_time64 (fd, &st) < 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
id->dev = st.st_dev;
|
id->dev = st.st_dev;
|
||||||
|
@ -119,7 +119,7 @@ int group_member ();
|
|||||||
int
|
int
|
||||||
euidaccess (const char *path, int mode)
|
euidaccess (const char *path, int mode)
|
||||||
{
|
{
|
||||||
struct stat64 stats;
|
struct __stat64_t64 stats;
|
||||||
int granted;
|
int granted;
|
||||||
|
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
@ -140,7 +140,7 @@ euidaccess (const char *path, int mode)
|
|||||||
return access (path, mode);
|
return access (path, mode);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (__stat64 (path, &stats))
|
if (__stat64_time64 (path, &stats))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
mode &= (X_OK | W_OK | R_OK); /* Clear any bogus bits. */
|
mode &= (X_OK | W_OK | R_OK); /* Clear any bogus bits. */
|
||||||
|
@ -1636,16 +1636,16 @@ static int gaiconf_reload_flag_ever_set;
|
|||||||
/* Last modification time. */
|
/* Last modification time. */
|
||||||
#ifdef _STATBUF_ST_NSEC
|
#ifdef _STATBUF_ST_NSEC
|
||||||
|
|
||||||
static struct timespec gaiconf_mtime;
|
static struct __timespec64 gaiconf_mtime;
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
save_gaiconf_mtime (const struct stat64 *st)
|
save_gaiconf_mtime (const struct __stat64_t64 *st)
|
||||||
{
|
{
|
||||||
gaiconf_mtime = st->st_mtim;
|
gaiconf_mtime = st->st_mtim;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
check_gaiconf_mtime (const struct stat64 *st)
|
check_gaiconf_mtime (const struct __stat64_t64 *st)
|
||||||
{
|
{
|
||||||
return (st->st_mtim.tv_sec == gaiconf_mtime.tv_sec
|
return (st->st_mtim.tv_sec == gaiconf_mtime.tv_sec
|
||||||
&& st->st_mtim.tv_nsec == gaiconf_mtime.tv_nsec);
|
&& st->st_mtim.tv_nsec == gaiconf_mtime.tv_nsec);
|
||||||
@ -1656,13 +1656,13 @@ check_gaiconf_mtime (const struct stat64 *st)
|
|||||||
static time_t gaiconf_mtime;
|
static time_t gaiconf_mtime;
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
save_gaiconf_mtime (const struct stat64 *st)
|
save_gaiconf_mtime (const struct __stat64_t64 *st)
|
||||||
{
|
{
|
||||||
gaiconf_mtime = st->st_mtime;
|
gaiconf_mtime = st->st_mtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
check_gaiconf_mtime (const struct stat64 *st)
|
check_gaiconf_mtime (const struct __stat64_t64 *st)
|
||||||
{
|
{
|
||||||
return st->st_mtime == gaiconf_mtime;
|
return st->st_mtime == gaiconf_mtime;
|
||||||
}
|
}
|
||||||
@ -1777,8 +1777,8 @@ gaiconf_init (void)
|
|||||||
FILE *fp = fopen (GAICONF_FNAME, "rce");
|
FILE *fp = fopen (GAICONF_FNAME, "rce");
|
||||||
if (fp != NULL)
|
if (fp != NULL)
|
||||||
{
|
{
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
if (__fstat64 (fileno (fp), &st) != 0)
|
if (__fstat64_time64 (fileno (fp), &st) != 0)
|
||||||
{
|
{
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
goto no_file;
|
goto no_file;
|
||||||
@ -2130,8 +2130,8 @@ gaiconf_init (void)
|
|||||||
static void
|
static void
|
||||||
gaiconf_reload (void)
|
gaiconf_reload (void)
|
||||||
{
|
{
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
if (__stat64 (GAICONF_FNAME, &st) != 0
|
if (__stat64_time64 (GAICONF_FNAME, &st) != 0
|
||||||
|| !check_gaiconf_mtime (&st))
|
|| !check_gaiconf_mtime (&st))
|
||||||
gaiconf_init ();
|
gaiconf_init ();
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ __getcwd_generic (char *buf, size_t size)
|
|||||||
ino_t rootino, thisino;
|
ino_t rootino, thisino;
|
||||||
char *dir;
|
char *dir;
|
||||||
register char *dirp;
|
register char *dirp;
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
size_t allocated = size;
|
size_t allocated = size;
|
||||||
size_t used;
|
size_t used;
|
||||||
|
|
||||||
@ -249,12 +249,12 @@ __getcwd_generic (char *buf, size_t size)
|
|||||||
dirp = dir + allocated;
|
dirp = dir + allocated;
|
||||||
*--dirp = '\0';
|
*--dirp = '\0';
|
||||||
|
|
||||||
if (__lstat64 (".", &st) < 0)
|
if (__lstat64_time64 (".", &st) < 0)
|
||||||
goto lose;
|
goto lose;
|
||||||
thisdev = st.st_dev;
|
thisdev = st.st_dev;
|
||||||
thisino = st.st_ino;
|
thisino = st.st_ino;
|
||||||
|
|
||||||
if (__lstat64 ("/", &st) < 0)
|
if (__lstat64_time64 ("/", &st) < 0)
|
||||||
goto lose;
|
goto lose;
|
||||||
rootdev = st.st_dev;
|
rootdev = st.st_dev;
|
||||||
rootino = st.st_ino;
|
rootino = st.st_ino;
|
||||||
@ -276,12 +276,12 @@ __getcwd_generic (char *buf, size_t size)
|
|||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
goto lose;
|
goto lose;
|
||||||
fd_needs_closing = true;
|
fd_needs_closing = true;
|
||||||
parent_status = __fstat64 (fd, &st);
|
parent_status = __fstat64_time64 (fd, &st);
|
||||||
#else
|
#else
|
||||||
dotlist[dotlen++] = '.';
|
dotlist[dotlen++] = '.';
|
||||||
dotlist[dotlen++] = '.';
|
dotlist[dotlen++] = '.';
|
||||||
dotlist[dotlen] = '\0';
|
dotlist[dotlen] = '\0';
|
||||||
parent_status = __lstat64 (dotlist, &st);
|
parent_status = __lstat64_time64 (dotlist, &st);
|
||||||
#endif
|
#endif
|
||||||
if (parent_status != 0)
|
if (parent_status != 0)
|
||||||
goto lose;
|
goto lose;
|
||||||
@ -353,7 +353,8 @@ __getcwd_generic (char *buf, size_t size)
|
|||||||
{
|
{
|
||||||
int entry_status;
|
int entry_status;
|
||||||
#if HAVE_OPENAT_SUPPORT
|
#if HAVE_OPENAT_SUPPORT
|
||||||
entry_status = __fstatat64 (fd, d->d_name, &st, AT_SYMLINK_NOFOLLOW);
|
entry_status = __fstatat64_time64 (fd, d->d_name, &st,
|
||||||
|
AT_SYMLINK_NOFOLLOW);
|
||||||
#else
|
#else
|
||||||
/* Compute size needed for this file name, or for the file
|
/* Compute size needed for this file name, or for the file
|
||||||
name ".." in the same directory, whichever is larger.
|
name ".." in the same directory, whichever is larger.
|
||||||
@ -390,7 +391,7 @@ __getcwd_generic (char *buf, size_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
memcpy (dotlist + dotlen, d->d_name, _D_ALLOC_NAMLEN (d));
|
memcpy (dotlist + dotlen, d->d_name, _D_ALLOC_NAMLEN (d));
|
||||||
entry_status = __lstat64 (dotlist, &st);
|
entry_status = __lstat64_time64 (dotlist, &st);
|
||||||
#endif
|
#endif
|
||||||
/* We don't fail here if we cannot stat() a directory entry.
|
/* We don't fail here if we cannot stat() a directory entry.
|
||||||
This can happen when (network) file systems fail. If this
|
This can happen when (network) file systems fail. If this
|
||||||
|
@ -129,9 +129,9 @@ __pathconf (const char *path, int name)
|
|||||||
#ifdef _POSIX_ASYNC_IO
|
#ifdef _POSIX_ASYNC_IO
|
||||||
{
|
{
|
||||||
/* AIO is only allowed on regular files and block devices. */
|
/* AIO is only allowed on regular files and block devices. */
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
|
|
||||||
if (__stat64 (path, &st) < 0
|
if (__stat64_time64 (path, &st) < 0
|
||||||
|| (! S_ISREG (st.st_mode) && ! S_ISBLK (st.st_mode)))
|
|| (! S_ISREG (st.st_mode) && ! S_ISBLK (st.st_mode)))
|
||||||
return -1;
|
return -1;
|
||||||
else
|
else
|
||||||
|
@ -1215,8 +1215,8 @@ __sysconf_check_spec (const char *spec)
|
|||||||
"/POSIX_V6_", sizeof ("/POSIX_V6_") - 1),
|
"/POSIX_V6_", sizeof ("/POSIX_V6_") - 1),
|
||||||
spec, speclen + 1);
|
spec, speclen + 1);
|
||||||
|
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
long int ret = __stat64 (name, &st) >= 0 ? 1 : -1;
|
long int ret = __stat64_time64 (name, &st) >= 0 ? 1 : -1;
|
||||||
|
|
||||||
__set_errno (save_errno);
|
__set_errno (save_errno);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -55,14 +55,14 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#if _LIBC
|
#if _LIBC
|
||||||
# define struct_stat64 struct stat64
|
# define struct_stat64 struct __stat64_t64
|
||||||
# define __secure_getenv __libc_secure_getenv
|
# define __secure_getenv __libc_secure_getenv
|
||||||
#else
|
#else
|
||||||
# define struct_stat64 struct stat
|
# define struct_stat64 struct stat
|
||||||
# define __gen_tempname gen_tempname
|
# define __gen_tempname gen_tempname
|
||||||
# define __mkdir mkdir
|
# define __mkdir mkdir
|
||||||
# define __open open
|
# 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 __stat64(file, buf) stat (file, buf)
|
||||||
# define __getrandom getrandom
|
# define __getrandom getrandom
|
||||||
# define __clock_gettime64 clock_gettime
|
# define __clock_gettime64 clock_gettime
|
||||||
@ -99,7 +99,7 @@ static int
|
|||||||
direxists (const char *dir)
|
direxists (const char *dir)
|
||||||
{
|
{
|
||||||
struct_stat64 buf;
|
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
|
/* Path search algorithm, for tmpnam, tmpfile, etc. If DIR is
|
||||||
@ -191,7 +191,7 @@ try_nocreate (char *tmpl, void *flags _GL_UNUSED)
|
|||||||
{
|
{
|
||||||
struct_stat64 st;
|
struct_stat64 st;
|
||||||
|
|
||||||
if (__lstat64 (tmpl, &st) == 0 || errno == EOVERFLOW)
|
if (__lstat64_time64 (tmpl, &st) == 0 || errno == EOVERFLOW)
|
||||||
__set_errno (EEXIST);
|
__set_errno (EEXIST);
|
||||||
return errno == ENOENT ? 0 : -1;
|
return errno == ENOENT ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
@ -27,9 +27,9 @@
|
|||||||
DIR *
|
DIR *
|
||||||
__fdopendir (int fd)
|
__fdopendir (int fd)
|
||||||
{
|
{
|
||||||
struct stat64 statbuf;
|
struct __stat64_t64 statbuf;
|
||||||
|
|
||||||
if (__builtin_expect (__fstat64 (fd, &statbuf), 0) < 0)
|
if (__glibc_unlikely (__fstat64_time64 (fd, &statbuf) < 0))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (__glibc_unlikely (! S_ISDIR (statbuf.st_mode)))
|
if (__glibc_unlikely (! S_ISDIR (statbuf.st_mode)))
|
||||||
{
|
{
|
||||||
|
@ -58,8 +58,8 @@ fexecve (int fd, char *const argv[], char *const envp[])
|
|||||||
|
|
||||||
/* We come here only if the 'execve' call fails. Determine whether
|
/* We come here only if the 'execve' call fails. Determine whether
|
||||||
/proc is mounted. If not we return ENOSYS. */
|
/proc is mounted. If not we return ENOSYS. */
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
if (__stat64 ("/proc/self/fd", &st) != 0 && errno == ENOENT)
|
if (__stat64_time64 ("/proc/self/fd", &st) != 0 && errno == ENOENT)
|
||||||
save = ENOSYS;
|
save = ENOSYS;
|
||||||
|
|
||||||
__set_errno (save);
|
__set_errno (save);
|
||||||
|
@ -49,8 +49,8 @@ opendir_tail (int fd)
|
|||||||
/* Now make sure this really is a directory and nothing changed since the
|
/* Now make sure this really is a directory and nothing changed since the
|
||||||
`stat' call. The S_ISDIR check is superfluous if O_DIRECTORY works,
|
`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. */
|
but it's cheap and we need the stat call for st_blksize anyway. */
|
||||||
struct stat64 statbuf;
|
struct __stat64_t64 statbuf;
|
||||||
if (__glibc_unlikely (__fstat64 (fd, &statbuf) < 0))
|
if (__glibc_unlikely (__fstat64_time64 (fd, &statbuf) < 0))
|
||||||
goto lose;
|
goto lose;
|
||||||
if (__glibc_unlikely (! S_ISDIR (statbuf.st_mode)))
|
if (__glibc_unlikely (! S_ISDIR (statbuf.st_mode)))
|
||||||
{
|
{
|
||||||
@ -88,7 +88,8 @@ __opendir (const char *name)
|
|||||||
weak_alias (__opendir, opendir)
|
weak_alias (__opendir, opendir)
|
||||||
|
|
||||||
DIR *
|
DIR *
|
||||||
__alloc_dir (int fd, bool close_fd, int flags, const struct stat64 *statp)
|
__alloc_dir (int fd, bool close_fd, int flags,
|
||||||
|
const struct __stat64_t64 *statp)
|
||||||
{
|
{
|
||||||
/* We have to set the close-on-exit flag if the user provided the
|
/* We have to set the close-on-exit flag if the user provided the
|
||||||
file descriptor. */
|
file descriptor. */
|
||||||
|
@ -65,9 +65,10 @@ distinguish_extX (const struct statfs *fsbuf, const char *file, int fd)
|
|||||||
{
|
{
|
||||||
char buf[64];
|
char buf[64];
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
|
|
||||||
if ((file == NULL ? __fstat64 (fd, &st) : __stat64 (file, &st)) != 0)
|
if ((file == NULL ? __fstat64_time64 (fd, &st)
|
||||||
|
: __stat64_time64 (file, &st)) != 0)
|
||||||
/* Strange. The statfd call worked, but stat fails. Default to
|
/* Strange. The statfd call worked, but stat fails. Default to
|
||||||
the more pessimistic value. */
|
the more pessimistic value. */
|
||||||
return EXT2_LINK_MAX;
|
return EXT2_LINK_MAX;
|
||||||
|
@ -25,24 +25,18 @@
|
|||||||
linux/Documentation/devices.txt (on linux < 4.10) or
|
linux/Documentation/devices.txt (on linux < 4.10) or
|
||||||
linux/Documentation/admin-guide/devices.txt (on linux >= 4.10). */
|
linux/Documentation/admin-guide/devices.txt (on linux >= 4.10). */
|
||||||
static inline bool
|
static inline bool
|
||||||
is_pty (struct stat64 *sb)
|
is_pty (struct __stat64_t64 *sb)
|
||||||
{
|
{
|
||||||
#ifdef _STATBUF_ST_RDEV
|
|
||||||
int m = __gnu_dev_major (sb->st_rdev);
|
int m = __gnu_dev_major (sb->st_rdev);
|
||||||
return (136 <= m && m <= 143);
|
return (136 <= m && m <= 143);
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
is_mytty (const struct stat64 *mytty, const struct stat64 *maybe)
|
is_mytty (const struct __stat64_t64 *mytty, const struct __stat64_t64 *maybe)
|
||||||
{
|
{
|
||||||
return (maybe->st_ino == mytty->st_ino
|
return (maybe->st_ino == mytty->st_ino
|
||||||
&& maybe->st_dev == mytty->st_dev
|
&& maybe->st_dev == mytty->st_dev
|
||||||
#ifdef _STATBUF_ST_RDEV
|
|
||||||
&& S_ISCHR (maybe->st_mode)
|
&& S_ISCHR (maybe->st_mode)
|
||||||
&& maybe->st_rdev == mytty->st_rdev
|
&& maybe->st_rdev == mytty->st_rdev
|
||||||
#endif
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -31,15 +31,15 @@
|
|||||||
#include "ttyname.h"
|
#include "ttyname.h"
|
||||||
|
|
||||||
static int getttyname_r (char *buf, size_t buflen,
|
static int getttyname_r (char *buf, size_t buflen,
|
||||||
const struct stat64 *mytty, int save,
|
const struct __stat64_t64 *mytty, int save,
|
||||||
int *dostat);
|
int *dostat);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
attribute_compat_text_section
|
attribute_compat_text_section
|
||||||
getttyname_r (char *buf, size_t buflen, const struct stat64 *mytty,
|
getttyname_r (char *buf, size_t buflen, const struct __stat64_t64 *mytty,
|
||||||
int save, int *dostat)
|
int save, int *dostat)
|
||||||
{
|
{
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
DIR *dirstream;
|
DIR *dirstream;
|
||||||
struct dirent64 *d;
|
struct dirent64 *d;
|
||||||
size_t devlen = strlen (buf);
|
size_t devlen = strlen (buf);
|
||||||
@ -71,7 +71,7 @@ getttyname_r (char *buf, size_t buflen, const struct stat64 *mytty,
|
|||||||
cp = __stpncpy (buf + devlen, d->d_name, needed);
|
cp = __stpncpy (buf + devlen, d->d_name, needed);
|
||||||
cp[0] = '\0';
|
cp[0] = '\0';
|
||||||
|
|
||||||
if (__stat64 (buf, &st) == 0
|
if (__stat64_time64 (buf, &st) == 0
|
||||||
&& is_mytty (mytty, &st))
|
&& is_mytty (mytty, &st))
|
||||||
{
|
{
|
||||||
(void) __closedir (dirstream);
|
(void) __closedir (dirstream);
|
||||||
@ -93,7 +93,7 @@ int
|
|||||||
__ttyname_r (int fd, char *buf, size_t buflen)
|
__ttyname_r (int fd, char *buf, size_t buflen)
|
||||||
{
|
{
|
||||||
struct fd_to_filename filename;
|
struct fd_to_filename filename;
|
||||||
struct stat64 st, st1;
|
struct __stat64_t64 st, st1;
|
||||||
int dostat = 0;
|
int dostat = 0;
|
||||||
int doispty = 0;
|
int doispty = 0;
|
||||||
int save = errno;
|
int save = errno;
|
||||||
@ -118,7 +118,7 @@ __ttyname_r (int fd, char *buf, size_t buflen)
|
|||||||
if (__glibc_unlikely (__tcgetattr (fd, &term) < 0))
|
if (__glibc_unlikely (__tcgetattr (fd, &term) < 0))
|
||||||
return errno;
|
return errno;
|
||||||
|
|
||||||
if (__fstat64 (fd, &st) < 0)
|
if (__fstat64_time64 (fd, &st) < 0)
|
||||||
return errno;
|
return errno;
|
||||||
|
|
||||||
/* We try using the /proc filesystem. */
|
/* We try using the /proc filesystem. */
|
||||||
@ -144,7 +144,7 @@ __ttyname_r (int fd, char *buf, size_t buflen)
|
|||||||
|
|
||||||
/* Verify readlink result, fall back on iterating through devices. */
|
/* Verify readlink result, fall back on iterating through devices. */
|
||||||
if (buf[0] == '/'
|
if (buf[0] == '/'
|
||||||
&& __stat64 (buf, &st1) == 0
|
&& __stat64_time64 (buf, &st1) == 0
|
||||||
&& is_mytty (&st, &st1))
|
&& is_mytty (&st, &st1))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ __ttyname_r (int fd, char *buf, size_t buflen)
|
|||||||
memcpy (buf, "/dev/pts/", sizeof ("/dev/pts/"));
|
memcpy (buf, "/dev/pts/", sizeof ("/dev/pts/"));
|
||||||
buflen -= sizeof ("/dev/pts/") - 1;
|
buflen -= sizeof ("/dev/pts/") - 1;
|
||||||
|
|
||||||
if (__stat64 (buf, &st1) == 0 && S_ISDIR (st1.st_mode))
|
if (__stat64_time64 (buf, &st1) == 0 && S_ISDIR (st1.st_mode))
|
||||||
{
|
{
|
||||||
ret = getttyname_r (buf, buflen, &st, save,
|
ret = getttyname_r (buf, buflen, &st, save,
|
||||||
&dostat);
|
&dostat);
|
||||||
|
@ -22,10 +22,10 @@
|
|||||||
key_t
|
key_t
|
||||||
ftok (const char *pathname, int proj_id)
|
ftok (const char *pathname, int proj_id)
|
||||||
{
|
{
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
key_t key;
|
key_t key;
|
||||||
|
|
||||||
if (__stat64 (pathname, &st) < 0)
|
if (__stat64_time64 (pathname, &st) < 0)
|
||||||
return (key_t) -1;
|
return (key_t) -1;
|
||||||
|
|
||||||
key = ((st.st_ino & 0xffff) | ((st.st_dev & 0xff) << 16)
|
key = ((st.st_ino & 0xffff) | ((st.st_dev & 0xff) << 16)
|
||||||
|
@ -150,9 +150,9 @@ __tzfile_read (const char *file, size_t extra, char **extrap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If we were already using tzfile, check whether the file changed. */
|
/* If we were already using tzfile, check whether the file changed. */
|
||||||
struct stat64 st;
|
struct __stat64_t64 st;
|
||||||
if (was_using_tzfile
|
if (was_using_tzfile
|
||||||
&& __stat64 (file, &st) == 0
|
&& __stat64_time64 (file, &st) == 0
|
||||||
&& tzfile_ino == st.st_ino && tzfile_dev == st.st_dev
|
&& tzfile_ino == st.st_ino && tzfile_dev == st.st_dev
|
||||||
&& tzfile_mtime == st.st_mtime)
|
&& tzfile_mtime == st.st_mtime)
|
||||||
goto done; /* Nothing to do. */
|
goto done; /* Nothing to do. */
|
||||||
@ -164,7 +164,7 @@ __tzfile_read (const char *file, size_t extra, char **extrap)
|
|||||||
goto ret_free_transitions;
|
goto ret_free_transitions;
|
||||||
|
|
||||||
/* Get information about the file we are actually using. */
|
/* Get information about the file we are actually using. */
|
||||||
if (__fstat64 (__fileno (f), &st) != 0)
|
if (__fstat64_time64 (__fileno (f), &st) != 0)
|
||||||
goto lose;
|
goto lose;
|
||||||
|
|
||||||
free ((void *) transitions);
|
free ((void *) transitions);
|
||||||
|
Loading…
Reference in New Issue
Block a user