aboutsummaryrefslogtreecommitdiff
path: root/newlib
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna-cygwin@cygwin.com>2019-07-24 22:32:18 +0200
committerCorinna Vinschen <corinna-cygwin@cygwin.com>2019-07-24 22:32:48 +0200
commit279805b20b9bbd1f73c50bf9e81dffb254f99fe8 (patch)
treefd04f5ce8f4c6fb092316bccc1d41a090fa22689 /newlib
parent884b05b54e4595433c85f8ca9820e88b4c723e38 (diff)
downloadnewlib-279805b20b9bbd1f73c50bf9e81dffb254f99fe8.zip
newlib-279805b20b9bbd1f73c50bf9e81dffb254f99fe8.tar.gz
newlib-279805b20b9bbd1f73c50bf9e81dffb254f99fe8.tar.bz2
hash functions: use reentrant stat functions
_stat64 and _fstat64 are not exported from Cygwin. Use the reentrant analogues, like everywhere else. Signed-off-by: Corinna Vinschen <corinna-cygwin@cygwin.com>
Diffstat (limited to 'newlib')
-rw-r--r--newlib/libc/search/hash.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/newlib/libc/search/hash.c b/newlib/libc/search/hash.c
index e409618..c76b157 100644
--- a/newlib/libc/search/hash.c
+++ b/newlib/libc/search/hash.c
@@ -140,9 +140,9 @@ __hash_open (const char *file,
new_table = 0;
if (!file || (flags & O_TRUNC) ||
#ifdef __USE_INTERNAL_STAT64
- (_stat64(file, &statbuf) && (errno == ENOENT))) {
+ (_stat64_r(_REENT, file, &statbuf) && (errno == ENOENT))) {
#else
- (stat(file, &statbuf) && (errno == ENOENT))) {
+ (_stat_r(_REENT, file, &statbuf) && (errno == ENOENT))) {
#endif
if (errno == ENOENT)
errno = 0; /* Just in case someone looks at errno */
@@ -156,9 +156,9 @@ __hash_open (const char *file,
a new .db file, then reinitialize the database */
if ((flags & O_CREAT) &&
#ifdef __USE_INTERNAL_STAT64
- _fstat64(hashp->fp, &statbuf) == 0 && statbuf.st_size == 0)
+ _fstat64_r(_REENT, hashp->fp, &statbuf) == 0 && statbuf.st_size == 0)
#else
- fstat(hashp->fp, &statbuf) == 0 && statbuf.st_size == 0)
+ _fstat_r(_REENT, hashp->fp, &statbuf) == 0 && statbuf.st_size == 0)
#endif
new_table = 1;
@@ -341,9 +341,9 @@ init_hash(hashp, file, info)
/* Fix bucket size to be optimal for file system */
if (file != NULL) {
#ifdef __USE_INTERNAL_STAT64
- if (_stat64(file, &statbuf))
+ if (_stat64_r(_REENT, file, &statbuf))
#else
- if (stat(file, &statbuf))
+ if (_stat_r(_REENT, file, &statbuf))
#endif
return (NULL);
hashp->BSIZE = MIN(statbuf.st_blksize, MAX_BSIZE);