ITS#7959 Check fstat return value

Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
mdb.RE/0.9
Jean-Christophe DUBOIS 10 years ago committed by Hallvard Furuseth
parent c473091f8f
commit 042e76685e
  1. 13
      libraries/liblmdb/mdb.c

@ -8692,14 +8692,23 @@ mdb_env_copyfd0(MDB_env *env, HANDLE fd)
#ifdef WIN32
{
LARGE_INTEGER fsize;
GetFileSizeEx(env->me_fd, &fsize);
if (!GetFileSizeEx(env->me_fd, &fsize)) {
rc = ErrCode();
goto leave;
}
if (w2 > fsize.QuadPart)
w2 = fsize.QuadPart;
}
#else
{
struct stat st;
fstat(env->me_fd, &st);
if ((rc = fstat(env->me_fd, &st))) {
goto leave;
}
if (w2 > (size_t)st.st_size)
w2 = st.st_size;
}

Loading…
Cancel
Save