From: Hallvard Furuseth Date: Wed, 3 Oct 2012 16:06:29 +0000 (+0200) Subject: ITS#7377 Catch ftruncate() error X-Git-Tag: OPENLDAP_REL_ENG_2_4_34~139^2~23 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ab3fea51dc890feaca7075643efe9410949e5363;p=openldap ITS#7377 Catch ftruncate() error --- diff --git a/libraries/libmdb/mdb.c b/libraries/libmdb/mdb.c index 42e33824b1..e92b5e7b1b 100644 --- a/libraries/libmdb/mdb.c +++ b/libraries/libmdb/mdb.c @@ -2629,7 +2629,8 @@ mdb_env_open2(MDB_env *env, unsigned int flags) prot = PROT_READ; if (flags & MDB_WRITEMAP) { prot |= PROT_WRITE; - ftruncate(env->me_fd, env->me_mapsize); + if (ftruncate(env->me_fd, env->me_mapsize) < 0) + return ErrCode(); } env->me_map = mmap(meta.mm_address, env->me_mapsize, prot, i, env->me_fd, 0);