summaryrefslogtreecommitdiffstats
path: root/newlib/libc/search/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/search/hash.c')
-rw-r--r--newlib/libc/search/hash.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/newlib/libc/search/hash.c b/newlib/libc/search/hash.c
index 10b4ded47..5429252b1 100644
--- a/newlib/libc/search/hash.c
+++ b/newlib/libc/search/hash.c
@@ -105,6 +105,7 @@ __hash_open(file, flags, mode, info, dflags)
const HASHINFO *info; /* Special directives for create */
{
HTAB *hashp;
+
struct stat statbuf;
DB *dbp;
int bpages, hdrsize, new_table, nsegs, save_errno;
@@ -128,7 +129,11 @@ __hash_open(file, flags, mode, info, dflags)
new_table = 0;
if (!file || (flags & O_TRUNC) ||
+#ifdef __CYGWIN_USE_BIG_TYPES__
+ (stat64(file, &statbuf) && (errno == ENOENT))) {
+#else
(stat(file, &statbuf) && (errno == ENOENT))) {
+#endif
if (errno == ENOENT)
errno = 0; /* Just in case someone looks at errno */
new_table = 1;
@@ -140,7 +145,11 @@ __hash_open(file, flags, mode, info, dflags)
/* if the .db file is empty, and we had permission to create
a new .db file, then reinitialize the database */
if ((flags & O_CREAT) &&
+#ifdef __CYGWIN_USE_BIG_TYPES__
+ fstat64(hashp->fp, &statbuf) == 0 && statbuf.st_size == 0)
+#else
fstat(hashp->fp, &statbuf) == 0 && statbuf.st_size == 0)
+#endif
new_table = 1;
#ifdef HAVE_FCNTL
@@ -314,7 +323,11 @@ init_hash(hashp, file, info)
/* Fix bucket size to be optimal for file system */
if (file != NULL) {
+#ifdef __CYGWIN_USE_BIG_TYPES__
+ if (stat64(file, &statbuf))
+#else
if (stat(file, &statbuf))
+#endif
return (NULL);
hashp->BSIZE = statbuf.st_blksize;
hashp->BSHIFT = __log2(hashp->BSIZE);