/* this is not actually used by tinyldap itself. */ /* 100% unit test coverage by unit tests in mstorage_add.c */ #include "mstorage.h" #include #include #include #include #include #include #include int mstorage_unmap(mstorage_t* p) { int r=0; #ifdef MREMAP_MAYMOVE if (p->root && p->root!=MAP_FAILED) if (munmap(p->root,p->mapped) == -1) r=-1; #else free(p->root); #endif if (p->fd!=-1) { r |= ftruncate(p->fd,p->used); r |= close(p->fd); } p->mapped=p->used=0; p->root=0; return r; }