summaryrefslogtreecommitdiff
path: root/source3/torture
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-08-02 19:22:22 +0200
committerVolker Lendecke <vl@samba.org>2010-08-04 20:32:50 +0200
commit867626abcad88b84684e9d328abf51d4f410a1cb (patch)
treea15ee1aefc33c3c1278e8ab955dcb8db38ab5463 /source3/torture
parent2ff73f0df3257c27cb3cdae779e679de3170be17 (diff)
downloadsamba-867626abcad88b84684e9d328abf51d4f410a1cb.tar.gz
samba-867626abcad88b84684e9d328abf51d4f410a1cb.tar.bz2
samba-867626abcad88b84684e9d328abf51d4f410a1cb.zip
s3: Convert cli_list() to return NTSTATUS
If needed, the callback functions can count themselves
Diffstat (limited to 'source3/torture')
-rw-r--r--source3/torture/torture.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index df8adbdfdf..cea7b8a4bf 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -4794,7 +4794,10 @@ static bool run_openattrtest(int dummy)
static void list_fn(const char *mnt, struct file_info *finfo,
const char *name, void *state)
{
-
+ int *matched = (int *)state;
+ if (matched != NULL) {
+ *matched += 1;
+ }
}
/*
@@ -4807,6 +4810,7 @@ static bool run_dirtest(int dummy)
uint16_t fnum;
struct timeval core_start;
bool correct = True;
+ int matched;
printf("starting directory test\n");
@@ -4829,9 +4833,17 @@ static bool run_dirtest(int dummy)
core_start = timeval_current();
- printf("Matched %d\n", cli_list(cli, "a*.*", 0, list_fn, NULL));
- printf("Matched %d\n", cli_list(cli, "b*.*", 0, list_fn, NULL));
- printf("Matched %d\n", cli_list(cli, "xyzabc", 0, list_fn, NULL));
+ matched = 0;
+ cli_list(cli, "a*.*", 0, list_fn, &matched);
+ printf("Matched %d\n", matched);
+
+ matched = 0;
+ cli_list(cli, "b*.*", 0, list_fn, &matched);
+ printf("Matched %d\n", matched);
+
+ matched = 0;
+ cli_list(cli, "xyzabc", 0, list_fn, &matched);
+ printf("Matched %d\n", matched);
printf("dirtest core %g seconds\n", timeval_elapsed(&core_start));
@@ -6173,6 +6185,7 @@ static void shortname_del_fn(const char *mnt, struct file_info *finfo,
}
struct sn_state {
+ int matched;
int i;
bool val;
};
@@ -6201,6 +6214,7 @@ static void shortname_list_fn(const char *mnt, struct file_info *finfo,
__location__, finfo->short_name, finfo->name);
s->val = true;
}
+ s->matched += 1;
}
static bool run_shortname_test(int dummy)
@@ -6255,7 +6269,11 @@ static bool run_shortname_test(int dummy)
goto out;
}
cli_close(cli, fnum);
- if (cli_list(cli, "\\shortname\\test*.*", 0, shortname_list_fn, &s) != 1) {
+
+ s.matched = 0;
+ cli_list(cli, "\\shortname\\test*.*", 0, shortname_list_fn,
+ &s);
+ if (s.matched != 1) {
d_printf("(%s) failed to list %s: %s\n",
__location__, fname, cli_errstr(cli));
correct = false;