diff --git a/newlib/libc/search/hash.c b/newlib/libc/search/hash.c index e409618af..c76b157b3 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);