aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/posix/getcwd.c
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-03-02 17:06:02 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-06-22 12:09:52 -0300
commit52a5fe70a2c77935afe807fb6e904e512ddd894e (patch)
treee17476a3ebc60b2e00aea93f24227199caaee8d4 /sysdeps/posix/getcwd.c
parenta318262bc0081ab83e3f3c90e50462f99148605e (diff)
downloadglibc-52a5fe70a2c77935afe807fb6e904e512ddd894e.tar
glibc-52a5fe70a2c77935afe807fb6e904e512ddd894e.tar.gz
glibc-52a5fe70a2c77935afe807fb6e904e512ddd894e.tar.bz2
glibc-52a5fe70a2c77935afe807fb6e904e512ddd894e.zip
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>
Diffstat (limited to 'sysdeps/posix/getcwd.c')
-rw-r--r--sysdeps/posix/getcwd.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/sysdeps/posix/getcwd.c b/sysdeps/posix/getcwd.c
index f11644aae7..13680026ff 100644
--- a/sysdeps/posix/getcwd.c
+++ b/sysdeps/posix/getcwd.c
@@ -183,7 +183,7 @@ __getcwd_generic (char *buf, size_t size)
ino_t rootino, thisino;
char *dir;
register char *dirp;
- struct stat64 st;
+ struct __stat64_t64 st;
size_t allocated = size;
size_t used;
@@ -249,12 +249,12 @@ __getcwd_generic (char *buf, size_t size)
dirp = dir + allocated;
*--dirp = '\0';
- if (__lstat64 (".", &st) < 0)
+ if (__lstat64_time64 (".", &st) < 0)
goto lose;
thisdev = st.st_dev;
thisino = st.st_ino;
- if (__lstat64 ("/", &st) < 0)
+ if (__lstat64_time64 ("/", &st) < 0)
goto lose;
rootdev = st.st_dev;
rootino = st.st_ino;
@@ -276,12 +276,12 @@ __getcwd_generic (char *buf, size_t size)
if (fd < 0)
goto lose;
fd_needs_closing = true;
- parent_status = __fstat64 (fd, &st);
+ parent_status = __fstat64_time64 (fd, &st);
#else
dotlist[dotlen++] = '.';
dotlist[dotlen++] = '.';
dotlist[dotlen] = '\0';
- parent_status = __lstat64 (dotlist, &st);
+ parent_status = __lstat64_time64 (dotlist, &st);
#endif
if (parent_status != 0)
goto lose;
@@ -353,7 +353,8 @@ __getcwd_generic (char *buf, size_t size)
{
int entry_status;
#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
/* Compute size needed for this file name, or for the file
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));
- entry_status = __lstat64 (dotlist, &st);
+ entry_status = __lstat64_time64 (dotlist, &st);
#endif
/* We don't fail here if we cannot stat() a directory entry.
This can happen when (network) file systems fail. If this