]> 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)
committerHoward Chu <hyc@symas.com>
Fri, 3 Oct 2014 20:10:49 +0000 (21:10 +0100)
Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
libraries/liblmdb/mdb.c

index 3a86b57f9c8b41d8aab34a0e68de5dbc2c0cf7a2..5361e054f7949a9eb513265913d0bdeb2a36fc37 100644 (file)
@@ -8724,14 +8724,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;
        }