public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin] hash functions: use reentrant stat functions
Date: Wed, 24 Jul 2019 20:33:00 -0000	[thread overview]
Message-ID: <20190724203334.114760.qmail@sourceware.org> (raw)

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);


                 reply	other threads:[~2019-07-24 20:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190724203334.114760.qmail@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=newlib-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).