diff options
author | Björn Baumbach <bb@sernet.de> | 2011-07-07 16:49:12 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2011-07-07 19:16:28 +0200 |
commit | 684095b0a2e24869b684cc12b92ed7847caf0021 (patch) | |
tree | a43e1c8bf248bc8c950050a98f65c301bb5ffef7 /source3 | |
parent | 840a1c7445377c24bfff04ffa619ea6b4aa83029 (diff) | |
download | samba-684095b0a2e24869b684cc12b92ed7847caf0021.tar.gz samba-684095b0a2e24869b684cc12b92ed7847caf0021.tar.bz2 samba-684095b0a2e24869b684cc12b92ed7847caf0021.zip |
s3-torture: run_simple_posix_open_test: Remove uses of cli_errstr()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/torture/torture.c | 52 |
1 files changed, 31 insertions, 21 deletions
diff --git a/source3/torture/torture.c b/source3/torture/torture.c index ab42c26b41..22beb7390b 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -5288,20 +5288,23 @@ static bool run_simple_posix_open_test(int dummy) } /* Create again to test open with O_TRUNC. */ - if (!NT_STATUS_IS_OK(cli_posix_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, 0600, &fnum1))) { - printf("POSIX create of %s failed (%s)\n", fname, cli_errstr(cli1)); + status = cli_posix_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, 0600, &fnum1); + if (!NT_STATUS_IS_OK(status)) { + printf("POSIX create of %s failed (%s)\n", fname, nt_errstr(status)); goto out; } /* Test ftruncate - set file size. */ - if (!NT_STATUS_IS_OK(cli_ftruncate(cli1, fnum1, 1000))) { - printf("ftruncate failed (%s)\n", cli_errstr(cli1)); + status = cli_ftruncate(cli1, fnum1, 1000); + if (!NT_STATUS_IS_OK(status)) { + printf("ftruncate failed (%s)\n", nt_errstr(status)); goto out; } /* Ensure st_size == 1000 */ - if (!NT_STATUS_IS_OK(cli_posix_stat(cli1, fname, &sbuf))) { - printf("stat failed (%s)\n", cli_errstr(cli1)); + status = cli_posix_stat(cli1, fname, &sbuf); + if (!NT_STATUS_IS_OK(status)) { + printf("stat failed (%s)\n", nt_errstr(status)); goto out; } @@ -5310,20 +5313,23 @@ static bool run_simple_posix_open_test(int dummy) goto out; } - if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) { - printf("close(2) failed (%s)\n", cli_errstr(cli1)); + status = cli_close(cli1, fnum1); + if (!NT_STATUS_IS_OK(status)) { + printf("close(2) failed (%s)\n", nt_errstr(status)); goto out; } /* Re-open with O_TRUNC. */ - if (!NT_STATUS_IS_OK(cli_posix_open(cli1, fname, O_WRONLY|O_TRUNC, 0600, &fnum1))) { - printf("POSIX create of %s failed (%s)\n", fname, cli_errstr(cli1)); + status = cli_posix_open(cli1, fname, O_WRONLY|O_TRUNC, 0600, &fnum1); + if (!NT_STATUS_IS_OK(status)) { + printf("POSIX create of %s failed (%s)\n", fname, nt_errstr(status)); goto out; } /* Ensure st_size == 0 */ - if (!NT_STATUS_IS_OK(cli_posix_stat(cli1, fname, &sbuf))) { - printf("stat failed (%s)\n", cli_errstr(cli1)); + status = cli_posix_stat(cli1, fname, &sbuf); + if (!NT_STATUS_IS_OK(status)) { + printf("stat failed (%s)\n", nt_errstr(status)); goto out; } @@ -5332,30 +5338,34 @@ static bool run_simple_posix_open_test(int dummy) goto out; } - if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) { - printf("close failed (%s)\n", cli_errstr(cli1)); + status = cli_close(cli1, fnum1); + if (!NT_STATUS_IS_OK(status)) { + printf("close failed (%s)\n", nt_errstr(status)); goto out; } - if (!NT_STATUS_IS_OK(cli_posix_unlink(cli1, fname))) { - printf("POSIX unlink of %s failed (%s)\n", fname, cli_errstr(cli1)); + status = cli_posix_unlink(cli1, fname); + if (!NT_STATUS_IS_OK(status)) { + printf("POSIX unlink of %s failed (%s)\n", fname, nt_errstr(status)); goto out; } - if (!NT_STATUS_IS_OK(cli_posix_open(cli1, dname, O_RDONLY, 0, &fnum1))) { + status = cli_posix_open(cli1, dname, O_RDONLY, 0, &fnum1); + if (!NT_STATUS_IS_OK(status)) { printf("POSIX open directory O_RDONLY of %s failed (%s)\n", - dname, cli_errstr(cli1)); + dname, nt_errstr(status)); goto out; } cli_close(cli1, fnum1); /* What happens when we try and POSIX open a directory for write ? */ - if (NT_STATUS_IS_OK(cli_posix_open(cli1, dname, O_RDWR, 0, &fnum1))) { + status = cli_posix_open(cli1, dname, O_RDWR, 0, &fnum1); + if (NT_STATUS_IS_OK(status)) { printf("POSIX open of directory %s succeeded, should have failed.\n", fname); goto out; } else { - if (!check_error(__LINE__, cli1, ERRDOS, EISDIR, + if (!check_both_error(__LINE__, status, ERRDOS, EISDIR, NT_STATUS_FILE_IS_A_DIRECTORY)) { goto out; } @@ -5433,7 +5443,7 @@ static bool run_simple_posix_open_test(int dummy) printf("POSIX open of %s succeeded (should have failed)\n", sname); goto out; } else { - if (!check_error(__LINE__, cli1, ERRDOS, ERRbadpath, + if (!check_both_error(__LINE__, status, ERRDOS, ERRbadpath, NT_STATUS_OBJECT_PATH_NOT_FOUND)) { printf("POSIX open of %s should have failed " "with NT_STATUS_OBJECT_PATH_NOT_FOUND, " |