diff options
author | Andrew Bartlett <abartlet@samba.org> | 2006-07-10 12:51:36 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:09:59 -0500 |
commit | 35fda6c5f344e71b1ed0bd195a62161e31401149 (patch) | |
tree | 6fd96d68dceac6bdde0ddf557b66103207e7be33 /source4/lib/tdb/tools | |
parent | bfc02627ceb02046fb23c62f28dc69765c8aa8f0 (diff) | |
download | samba-35fda6c5f344e71b1ed0bd195a62161e31401149.tar.gz samba-35fda6c5f344e71b1ed0bd195a62161e31401149.tar.bz2 samba-35fda6c5f344e71b1ed0bd195a62161e31401149.zip |
r16916: Implement metze's proposed changes to the tdb logging API.
This clearly links the log function with its private pointer, and
makes the argument list for tdb_open_ex a bit shorter.
Andrew Bartlett
(This used to be commit 5d5503e8d8a10ead3ef21a5ffda52cadb9a07727)
Diffstat (limited to 'source4/lib/tdb/tools')
-rw-r--r-- | source4/lib/tdb/tools/tdbtool.c | 5 | ||||
-rw-r--r-- | source4/lib/tdb/tools/tdbtorture.c | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/source4/lib/tdb/tools/tdbtool.c b/source4/lib/tdb/tools/tdbtool.c index 5aa47bd9f5..7f7dce8c3c 100644 --- a/source4/lib/tdb/tools/tdbtool.c +++ b/source4/lib/tdb/tools/tdbtool.c @@ -183,6 +183,9 @@ static char *get_token(int startover) static void create_tdb(void) { + struct tdb_logging_context log_ctx; + log_ctx.log_fn = tdb_log; + char *tok = get_token(1); if (!tok) { help(); @@ -190,7 +193,7 @@ static void create_tdb(void) } if (tdb) tdb_close(tdb); tdb = tdb_open_ex(tok, 0, TDB_CLEAR_IF_FIRST, - O_RDWR | O_CREAT | O_TRUNC, 0600, tdb_log, NULL, NULL); + O_RDWR | O_CREAT | O_TRUNC, 0600, log_ctx, NULL); if (!tdb) { printf("Could not create %s: %s\n", tok, strerror(errno)); } diff --git a/source4/lib/tdb/tools/tdbtorture.c b/source4/lib/tdb/tools/tdbtorture.c index 559a84d99b..d88211c4a7 100644 --- a/source4/lib/tdb/tools/tdbtorture.c +++ b/source4/lib/tdb/tools/tdbtorture.c @@ -237,6 +237,9 @@ static void usage(void) extern char *optarg; pid_t *pids; + struct tdb_logging_context log_ctx; + log_ctx.log_fn = tdb_log; + while ((c = getopt(argc, argv, "n:l:s:H:h")) != -1) { switch (c) { case 'n': @@ -266,7 +269,7 @@ static void usage(void) } db = tdb_open_ex("torture.tdb", hash_size, TDB_CLEAR_IF_FIRST, - O_RDWR | O_CREAT, 0600, tdb_log, NULL, NULL); + O_RDWR | O_CREAT, 0600, &log_ctx, NULL); if (!db) { fatal("db open failed"); } |