From: Howard Chu Date: Fri, 12 Jul 2013 19:53:35 +0000 (-0700) Subject: Fix env_read_header() on Windows X-Git-Tag: OPENLDAP_REL_ENG_2_4_36~32^2~21 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ba6dfe0bbb454a41c1c1ad8a29238925b1927980;p=openldap Fix env_read_header() on Windows Commit d6d2638acc245116b8f091ac425b6700d06c4713 broke read on zero-length files. --- diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 0ba5e2dbd0..b186ba7411 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -2487,6 +2487,8 @@ mdb_env_read_header(MDB_env *env, MDB_meta *meta) memset(&ov, 0, sizeof(ov)); ov.Offset = off; rc = ReadFile(env->me_fd,&pbuf,MDB_PAGESIZE,&len,&ov) ? (int)len : -1; + if (rc == -1 && ErrCode() == ERROR_HANDLE_EOF) + rc = 0; #else rc = pread(env->me_fd, &pbuf, MDB_PAGESIZE, off); #endif