From 9874ebc3d3355465f884f3aad4d69914a4e1f0c5 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 30 Mar 2001 06:31:22 +0000 Subject: Added one more test - just to make sure flag can be unset. Jeremy. (This used to be commit 54960b9c8d6be6646a0c0e8ef9ee6c61a4b69cf8) --- source3/utils/torture.c | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'source3/utils') diff --git a/source3/utils/torture.c b/source3/utils/torture.c index 0869e5e019..8588aa9610 100644 --- a/source3/utils/torture.c +++ b/source3/utils/torture.c @@ -2282,10 +2282,52 @@ static void run_deletetest(int dummy) printf("sixth delete on close test succeeded.\n"); + /* Test 7 ... */ cli_setatr(&cli1, fname, 0, 0); cli_unlink(&cli1, fname); - printf("finished delete test 1\n"); + fnum1 = cli_nt_create_full(&cli1, fname, FILE_READ_DATA|FILE_WRITE_DATA|DELETE_ACCESS, + FILE_ATTRIBUTE_NORMAL, 0, FILE_OVERWRITE_IF, 0); + + if (fnum1 == -1) { + printf("[7] open of %s failed (%s)\n", fname, cli_errstr(&cli1)); + return; + } + + if (!cli_nt_delete_on_close(&cli1, fnum1, True)) { + printf("[7] setting delete_on_close on file failed !\n"); + return; + } + + if (!cli_nt_delete_on_close(&cli1, fnum1, False)) { + printf("[7] unsetting delete_on_close on file failed !\n"); + return; + } + + if (!cli_close(&cli1, fnum1)) { + printf("[7] close - 2 failed (%s)\n", cli_errstr(&cli1)); + return; + } + + /* This next open should succeed - we reset the flag. */ + + fnum1 = cli_open(&cli1, fname, O_RDONLY, DENY_NONE); + if (fnum1 == -1) { + printf("[5] open of %s failed (%s)\n", fname, cli_errstr(&cli1)); + return; + } + + if (!cli_close(&cli1, fnum1)) { + printf("[7] close - 2 failed (%s)\n", cli_errstr(&cli1)); + return; + } + + printf("seventh delete on close test succeeded.\n"); + + cli_setatr(&cli1, fname, 0, 0); + cli_unlink(&cli1, fname); + + printf("finished delete test\n"); close_connection(&cli1); } -- cgit