]> git.sur5r.net Git - openldap/commitdiff
ITS#7959 Check fstat return value
authorJean-Christophe DUBOIS <jcd@tribudubois.net>
Fri, 3 Oct 2014 18:24:25 +0000 (20:24 +0200)
committerHallvard Furuseth <hallvard@openldap.org>
Mon, 1 Dec 2014 19:15:36 +0000 (20:15 +0100)
Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
libraries/liblmdb/mdb.c

index cfa24bf0db47033f768d3cf83193e88c0c021ee4..63445ce7af2f9ed55a6c7756edf4a1492a49a0f1 100644 (file)
@@ -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;
        }