From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 114804 invoked by alias); 24 Jul 2019 20:33:34 -0000 Mailing-List: contact newlib-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-cvs-owner@sourceware.org Received: (qmail 114762 invoked by uid 9078); 24 Jul 2019 20:33:34 -0000 Date: Wed, 24 Jul 2019 20:33:00 -0000 Message-ID: <20190724203334.114760.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] hash functions: use reentrant stat functions X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/master X-Git-Oldrev: 884b05b54e4595433c85f8ca9820e88b4c723e38 X-Git-Newrev: 279805b20b9bbd1f73c50bf9e81dffb254f99fe8 X-SW-Source: 2019-q3/txt/msg00006.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=279805b20b9bbd1f73c50bf9e81dffb254f99fe8 commit 279805b20b9bbd1f73c50bf9e81dffb254f99fe8 Author: Corinna Vinschen 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 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);