diff options
author | Noriko Hosoi <nhosoi@redhat.com> | 2005-04-01 16:51:44 +0000 |
---|---|---|
committer | Noriko Hosoi <nhosoi@redhat.com> | 2005-04-01 16:51:44 +0000 |
commit | db347aecd2eb21203fd186b8b02c9b921d74f246 (patch) | |
tree | b5f70995f4b7b48201e3fe98922a1ed0843bf0ff | |
parent | 9d423b0cf872ad3605746c246787629f00fa992c (diff) | |
download | ds-db347aecd2eb21203fd186b8b02c9b921d74f246.tar.gz ds-db347aecd2eb21203fd186b8b02c9b921d74f246.tar.xz ds-db347aecd2eb21203fd186b8b02c9b921d74f246.zip |
fixed a bug on the static variable introduced by the previous commit.
-rw-r--r-- | ldap/servers/slapd/tools/dbscan.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ldap/servers/slapd/tools/dbscan.c b/ldap/servers/slapd/tools/dbscan.c index 7a0e3f33..9653ee93 100644 --- a/ldap/servers/slapd/tools/dbscan.c +++ b/ldap/servers/slapd/tools/dbscan.c @@ -174,7 +174,7 @@ static char *format_entry(unsigned char *s, int len) return format_raw(s, len, FMT_LF_OK | FMT_SP_OK); } -static char *idl_format(IDL *idl, int *done) +static char *idl_format(IDL *idl, int isfirsttime, int *done) { static char *buf = NULL; static uint32 i = 0; @@ -186,10 +186,14 @@ static char *idl_format(IDL *idl, int *done) } buf[0] = 0; + if (0 != isfirsttime) { + i = 0; + } for (; i < idl->used; i++) { sprintf((char *)buf + strlen(buf), "%d ", idl->id[i]); if (strlen(buf) > (size_t)MAX_BUFFER-MIN_BUFFER) { + i++; done = 0; return (char *)buf; } @@ -508,7 +512,7 @@ static void display_item(DBC *cursor, DBT *key, DBT *data) int isfirsttime = 1; printf("%s\n", format(key->data, key->size)); while (0 == done) { - formatted_idl = idl_format(idl, &done); + formatted_idl = idl_format(idl, isfirsttime, &done); if (NULL == formatted_idl) { done = 1; /* no more idl */ } else { |