diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2011-06-20 18:40:33 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2011-06-20 11:18:36 +0200 |
commit | 5eecc854236f0b943aaa89e0c3a46f9fbd208ca9 (patch) | |
tree | 89ae34b70f5a32f22b301ec9e4db363e046737cd /lib/tdb2 | |
parent | 957801fcb0c81317c84d448f1e04d069216f07ac (diff) | |
download | samba-5eecc854236f0b943aaa89e0c3a46f9fbd208ca9.tar.gz samba-5eecc854236f0b943aaa89e0c3a46f9fbd208ca9.tar.bz2 samba-5eecc854236f0b943aaa89e0c3a46f9fbd208ca9.zip |
tdb2: create tdb2 versions of various testing TDBs.
Soon, TDB2 will handle tdb1 files, but until then, we substitute.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/tdb2')
-rw-r--r-- | lib/tdb2/pytdb.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/tdb2/pytdb.c b/lib/tdb2/pytdb.c index 86f604874b..c760045508 100644 --- a/lib/tdb2/pytdb.c +++ b/lib/tdb2/pytdb.c @@ -72,12 +72,21 @@ static PyObject *PyString_FromTDB_DATA(TDB_DATA data) return NULL; \ } +static void stderr_log(struct tdb_context *tdb, + enum tdb_log_level level, + const char *message, + void *data) +{ + fprintf(stderr, "%s:%s\n", tdb_name(tdb), message); +} + static PyObject *py_tdb_open(PyTypeObject *type, PyObject *args, PyObject *kwargs) { char *name = NULL; int tdb_flags = TDB_DEFAULT, flags = O_RDWR, mode = 0600; struct tdb_context *ctx; PyTdbObject *ret; + union tdb_attribute logattr; const char *kwnames[] = { "name", "tdb_flags", "flags", "mode", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|siii", (char **)kwnames, &name, &tdb_flags, &flags, &mode)) @@ -87,7 +96,10 @@ static PyObject *py_tdb_open(PyTypeObject *type, PyObject *args, PyObject *kwarg tdb_flags |= TDB_INTERNAL; } - ctx = tdb_open(name, tdb_flags, flags, mode, NULL); + logattr.log.base.attr = TDB_ATTRIBUTE_LOG; + logattr.log.base.next = NULL; + logattr.log.fn = stderr_log; + ctx = tdb_open(name, tdb_flags, flags, mode, &logattr); if (ctx == NULL) { PyErr_SetFromErrno(PyExc_IOError); return NULL; |