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>
This commit is contained in:
parent
884b05b54e
commit
279805b20b
|
@ -140,9 +140,9 @@ __hash_open (const char *file,
|
||||||
new_table = 0;
|
new_table = 0;
|
||||||
if (!file || (flags & O_TRUNC) ||
|
if (!file || (flags & O_TRUNC) ||
|
||||||
#ifdef __USE_INTERNAL_STAT64
|
#ifdef __USE_INTERNAL_STAT64
|
||||||
(_stat64(file, &statbuf) && (errno == ENOENT))) {
|
(_stat64_r(_REENT, file, &statbuf) && (errno == ENOENT))) {
|
||||||
#else
|
#else
|
||||||
(stat(file, &statbuf) && (errno == ENOENT))) {
|
(_stat_r(_REENT, file, &statbuf) && (errno == ENOENT))) {
|
||||||
#endif
|
#endif
|
||||||
if (errno == ENOENT)
|
if (errno == ENOENT)
|
||||||
errno = 0; /* Just in case someone looks at errno */
|
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 */
|
a new .db file, then reinitialize the database */
|
||||||
if ((flags & O_CREAT) &&
|
if ((flags & O_CREAT) &&
|
||||||
#ifdef __USE_INTERNAL_STAT64
|
#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
|
#else
|
||||||
fstat(hashp->fp, &statbuf) == 0 && statbuf.st_size == 0)
|
_fstat_r(_REENT, hashp->fp, &statbuf) == 0 && statbuf.st_size == 0)
|
||||||
#endif
|
#endif
|
||||||
new_table = 1;
|
new_table = 1;
|
||||||
|
|
||||||
|
@ -341,9 +341,9 @@ init_hash(hashp, file, info)
|
||||||
/* Fix bucket size to be optimal for file system */
|
/* Fix bucket size to be optimal for file system */
|
||||||
if (file != NULL) {
|
if (file != NULL) {
|
||||||
#ifdef __USE_INTERNAL_STAT64
|
#ifdef __USE_INTERNAL_STAT64
|
||||||
if (_stat64(file, &statbuf))
|
if (_stat64_r(_REENT, file, &statbuf))
|
||||||
#else
|
#else
|
||||||
if (stat(file, &statbuf))
|
if (_stat_r(_REENT, file, &statbuf))
|
||||||
#endif
|
#endif
|
||||||
return (NULL);
|
return (NULL);
|
||||||
hashp->BSIZE = MIN(statbuf.st_blksize, MAX_BSIZE);
|
hashp->BSIZE = MIN(statbuf.st_blksize, MAX_BSIZE);
|
||||||
|
|
Loading…
Reference in New Issue