summaryrefslogtreecommitdiff
path: root/source3/torture/nbio.c
diff options
context:
space:
mode:
authorRichard Sharpe <sharpe@samba.org>2002-04-17 22:50:02 +0000
committerRichard Sharpe <sharpe@samba.org>2002-04-17 22:50:02 +0000
commit4e5e5481707537c93f8ab7b9eae00498131ed5d9 (patch)
tree67962f67f7e856643b02a1b545f90d3d4ddbe134 /source3/torture/nbio.c
parent82b573678d8b271bfaa00a36359916e8579e8499 (diff)
downloadsamba-4e5e5481707537c93f8ab7b9eae00498131ed5d9.tar.gz
samba-4e5e5481707537c93f8ab7b9eae00498131ed5d9.tar.bz2
samba-4e5e5481707537c93f8ab7b9eae00498131ed5d9.zip
Fix smbtorture so it can handle collisions etc ...
(This used to be commit ba4d6c76aabd3d1fd8dc1e2335baf50c58d636a7)
Diffstat (limited to 'source3/torture/nbio.c')
-rw-r--r--source3/torture/nbio.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/source3/torture/nbio.c b/source3/torture/nbio.c
index 0d6955c879..bf9305f8e8 100644
--- a/source3/torture/nbio.c
+++ b/source3/torture/nbio.c
@@ -79,6 +79,16 @@ void nbio_shmem(int n)
}
}
+static int ne_find_handle(int handle)
+{
+ int i;
+ children[nbio_id].line = line_count;
+ for (i=0;i<MAX_FILES;i++) {
+ if (ftable[i].handle == handle) return i;
+ }
+ return -1;
+}
+
static int find_handle(int handle)
{
int i;
@@ -127,7 +137,7 @@ void nb_unlink(char *fname)
void nb_createx(char *fname,
- unsigned create_options, unsigned create_disposition, int handle)
+ unsigned create_options, unsigned create_disposition, int handle, int no_err)
{
int fd, i;
uint32 desired_access;
@@ -147,7 +157,7 @@ void nb_createx(char *fname,
if (fd == -1 && handle != -1) {
printf("ERROR: cli_nt_create_full failed for %s - %s\n",
fname, cli_errstr(c));
- exit(1);
+ if (!no_err) exit(1);
}
if (fd != -1 && handle == -1) {
printf("ERROR: cli_nt_create_full succeeded for %s\n", fname);
@@ -196,10 +206,15 @@ void nb_readx(int handle, int offset, int size, int ret_size)
children[nbio_id].bytes_in += ret_size;
}
-void nb_close(int handle)
+void nb_close(int handle, int no_err)
{
int i;
- i = find_handle(handle);
+ if (no_err) {
+ i = ne_find_handle(handle);
+ if (i < 0) return;
+ }
+ else
+ i = find_handle(handle);
if (!cli_close(c, ftable[i].fd)) {
printf("(%d) close failed on handle %d\n", line_count, handle);
exit(1);