public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] hash functions: use reentrant stat functions
@ 2019-07-24 20:33 Corinna Vinschen
0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2019-07-24 20:33 UTC (permalink / raw)
To: newlib-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=279805b20b9bbd1f73c50bf9e81dffb254f99fe8
commit 279805b20b9bbd1f73c50bf9e81dffb254f99fe8
Author: Corinna Vinschen <corinna-cygwin@cygwin.com>
Date: Wed Jul 24 22:32:18 2019 +0200
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>
Diff:
---
newlib/libc/search/hash.c | 12 ++++++------
1 file 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);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-07-24 20:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-24 20:33 [newlib-cygwin] hash functions: use reentrant stat functions Corinna Vinschen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).