From 949eb20a1ab73e5da068183e8b05b114206dd555 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 12 Feb 2007 23:16:02 +0000 Subject: r21303: As discussed on samba-technical: Change the static array for the in-memory mirrors of the hash chain locks to a dynamically allocated one. Jeremy, I count on you to revert it if the build farm freaks out, it's after midnight here :-) Volker (This used to be commit c50f099be1fcae2d533e1c3816cb25c315ba167a) --- source3/tdb/common/open.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'source3/tdb/common/open.c') diff --git a/source3/tdb/common/open.c b/source3/tdb/common/open.c index 224103e679..3f0c35331b 100644 --- a/source3/tdb/common/open.c +++ b/source3/tdb/common/open.c @@ -263,15 +263,6 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, tdb->map_size = st.st_size; tdb->device = st.st_dev; tdb->inode = st.st_ino; - tdb->locked = (struct tdb_lock_type *)calloc(tdb->header.hash_size+1, - sizeof(tdb->locked[0])); - if (!tdb->locked) { - TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: " - "failed to allocate lock structure for %s\n", - name)); - errno = ENOMEM; - goto fail; - } tdb_mmap(tdb); if (locked) { if (tdb->methods->tdb_brlock(tdb, ACTIVE_LOCK, F_UNLCK, F_SETLK, 0, 1) == -1) { @@ -324,7 +315,6 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, if (tdb->fd != -1) if (close(tdb->fd) != 0) TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: failed to close tdb->fd on error!\n")); - SAFE_FREE(tdb->locked); SAFE_FREE(tdb); errno = save_errno; return NULL; @@ -354,7 +344,7 @@ int tdb_close(struct tdb_context *tdb) SAFE_FREE(tdb->name); if (tdb->fd != -1) ret = close(tdb->fd); - SAFE_FREE(tdb->locked); + SAFE_FREE(tdb->lockrecs); /* Remove from contexts list */ for (i = &tdbs; *i; i = &(*i)->next) { -- cgit