summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-04-13 20:49:11 +0000
committerJeremy Allison <jra@samba.org>2001-04-13 20:49:11 +0000
commit819482c07137937ee0c063437d2b2eade2895b99 (patch)
tree1f47417e5ff9791f9a5e74050d1faad49ea28f01 /source3/utils
parent3c2c047e822b6c74ecc176d1623d5292657cde62 (diff)
downloadsamba-819482c07137937ee0c063437d2b2eade2895b99.tar.gz
samba-819482c07137937ee0c063437d2b2eade2895b99.tar.bz2
samba-819482c07137937ee0c063437d2b2eade2895b99.zip
Fixed potential file descriptor leak with MS-Access fix.
Jeremy. (This used to be commit 192887fe72157a141b8df1977085f479e5204782)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/torture.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/source3/utils/torture.c b/source3/utils/torture.c
index ac922eed61..446bf7eaf2 100644
--- a/source3/utils/torture.c
+++ b/source3/utils/torture.c
@@ -2431,7 +2431,7 @@ static void run_opentest(int dummy)
return;
}
- /* This will fail - but the error should be ERRnoaccess, not ERRshare. */
+ /* This will fail - but the error should be ERRnoaccess, not ERRbadshare. */
fnum2 = cli_open(&cli1, fname, O_RDWR, DENY_ALL);
cli_error( &cli1, &eclass, &errnum, NULL);
@@ -2444,14 +2444,37 @@ static void run_opentest(int dummy)
}
+ printf("finished open test 1\n");
+
cli_close(&cli1, fnum1);
+ /* Now try not readonly and ensure ERRbadshare is returned. */
+
cli_setatr(&cli1, fname, 0, 0);
+
+ fnum1 = cli_open(&cli1, fname, O_RDONLY, DENY_WRITE);
+ if (fnum1 == -1) {
+ printf("open of %s failed (%s)\n", fname, cli_errstr(&cli1));
+ return;
+ }
+
+ /* This will fail - but the error should be ERRshare. */
+ fnum2 = cli_open(&cli1, fname, O_RDWR, DENY_ALL);
+
+ cli_error( &cli1, &eclass, &errnum, NULL);
+
+ if (eclass != ERRDOS || errnum != ERRbadshare) {
+ printf("wrong error code (%x,%x) = %s\n", (unsigned int)eclass,
+ (unsigned int)errnum, cli_errstr(&cli1) );
+ } else {
+ printf("correct error code ERRDOS/ERRbadshare returned\n");
+ }
+
cli_unlink(&cli1, fname);
close_connection(&cli1);
- printf("finished open test 1\n");
+ printf("finished open test 2\n");
}
static void list_fn(file_info *finfo, const char *name, void *state)