]> git.sur5r.net Git - openldap/commitdiff
ITS#7377 Catch ftruncate() error
authorHallvard Furuseth <hallvard@openldap.org>
Wed, 3 Oct 2012 16:06:29 +0000 (18:06 +0200)
committerHallvard Furuseth <hallvard@openldap.org>
Wed, 3 Oct 2012 16:06:29 +0000 (18:06 +0200)
libraries/libmdb/mdb.c

index 42e33824b106515c932775d752dee80b3af58b89..e92b5e7b1bd11f1947cb2dfaf03e6fcd424833d7 100644 (file)
@@ -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);