From 317106452176da6e6ef36bb4189be609e0638a11 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 3 Dec 2001 00:23:14 +0000 Subject: Updated definition of fstring. print_asc(): Don't try to print a trailing NULL character print_key(), print_rec(): Display key in ASCII (This used to be commit 303b3a35951211775a4e87bcca47cc21236aa422) --- source3/tdb/tdbtool.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'source3/tdb/tdbtool.c') diff --git a/source3/tdb/tdbtool.c b/source3/tdb/tdbtool.c index 4e674664b7..4198d12418 100644 --- a/source3/tdb/tdbtool.c +++ b/source3/tdb/tdbtool.c @@ -37,7 +37,7 @@ /* a tdb tool for manipulating a tdb database */ -#define FSTRING_LEN 128 +#define FSTRING_LEN 256 typedef char fstring[FSTRING_LEN]; typedef struct connections_key { @@ -65,6 +65,13 @@ static int print_rec(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state) static void print_asc(unsigned char *buf,int len) { int i; + + /* We're probably printing ASCII strings so don't try to display + the trailing NULL character. */ + + if (buf[len - 1] == 0) + len--; + for (i=0;i