summaryrefslogtreecommitdiff
path: root/source3/tdb
diff options
context:
space:
mode:
authorMartin Pool <mbp@samba.org>2001-12-10 07:02:24 +0000
committerMartin Pool <mbp@samba.org>2001-12-10 07:02:24 +0000
commit98d6d8cf9c581a88341e5b1bf093a2b6f6bed522 (patch)
treeb07e6da27afb16ea0d5182f8bf7fcf914c4aa87f /source3/tdb
parent43069e54754dbb0928776e9cb1dcccb8954df8f0 (diff)
downloadsamba-98d6d8cf9c581a88341e5b1bf093a2b6f6bed522.tar.gz
samba-98d6d8cf9c581a88341e5b1bf093a2b6f6bed522.tar.bz2
samba-98d6d8cf9c581a88341e5b1bf093a2b6f6bed522.zip
Log more error messages.
(This used to be commit b50e566ab93e9a8068e26c9c902db81311cb394c)
Diffstat (limited to 'source3/tdb')
-rw-r--r--source3/tdb/tdb.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/source3/tdb/tdb.c b/source3/tdb/tdb.c
index 1ca2974591..ac1901649d 100644
--- a/source3/tdb/tdb.c
+++ b/source3/tdb/tdb.c
@@ -1469,7 +1469,10 @@ TDB_CONTEXT *tdb_open_ex(char *name, int hash_size, int tdb_flags,
if ((locked = (tdb_brlock(tdb, ACTIVE_LOCK, F_WRLCK, F_SETLK, 0) == 0))
&& (tdb_flags & TDB_CLEAR_IF_FIRST)) {
open_flags |= O_CREAT;
- if (ftruncate(tdb->fd, 0) == -1)
+ if (ftruncate(tdb->fd, 0) == -1) {
+ TDB_LOG((tdb, 0, "tdb_open_ex: "
+ "failed to truncate %s: %s\n",
+ name, strerror(errno)));
goto fail; /* errno set by ftruncate */
}
@@ -1507,6 +1510,9 @@ TDB_CONTEXT *tdb_open_ex(char *name, int hash_size, int tdb_flags,
tdb->inode = st.st_ino;
tdb->locked = calloc(tdb->header.hash_size+1, sizeof(tdb->locked[0]));
if (!tdb->locked) {
+ TDB_LOG((tdb, 2, "tdb_open_ex: "
+ "failed to allocate lock structure for %s\n",
+ name));
errno = ENOMEM;
goto fail;
}
@@ -1514,8 +1520,12 @@ TDB_CONTEXT *tdb_open_ex(char *name, int hash_size, int tdb_flags,
if (locked) {
if (!tdb->read_only)
tdb_clear_spinlocks(tdb);
- if (tdb_brlock(tdb, ACTIVE_LOCK, F_UNLCK, F_SETLK, 0) == -1)
+ if (tdb_brlock(tdb, ACTIVE_LOCK, F_UNLCK, F_SETLK, 0) == -1) {
+ TDB_LOG((tdb, 0, "tdb_open_ex: "
+ "failed to take ACTIVE_LOCK on %s: %s\n",
+ name, strerror(errno)));
goto fail;
+ }
}
/* leave this lock in place to indicate it's in use */
if (tdb_brlock(tdb, ACTIVE_LOCK, F_RDLCK, F_SETLKW, 0) == -1)