summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/client/client.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index 978f2e5dd6..e2efad82d8 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -2570,14 +2570,21 @@ static int cmd_posix_open(void)
return 1;
}
- if (!NT_STATUS_IS_OK(cli_posix_open(targetcli, targetname, O_CREAT|O_RDWR, mode, &fnum))) {
- if (!NT_STATUS_IS_OK(cli_posix_open(targetcli, targetname, O_CREAT|O_RDONLY, mode, &fnum))) {
- d_printf("Failed to open file %s. %s\n", targetname, cli_errstr(cli));
+ status = cli_posix_open(targetcli, targetname, O_CREAT|O_RDWR, mode,
+ &fnum);
+ if (!NT_STATUS_IS_OK(status)) {
+ status = cli_posix_open(targetcli, targetname,
+ O_CREAT|O_RDONLY, mode, &fnum);
+ if (!NT_STATUS_IS_OK(status)) {
+ d_printf("Failed to open file %s. %s\n", targetname,
+ nt_errstr(status));
} else {
- d_printf("posix_open file %s: for readonly fnum %d\n", targetname, fnum);
+ d_printf("posix_open file %s: for readonly fnum %d\n",
+ targetname, fnum);
}
} else {
- d_printf("posix_open file %s: for read/write fnum %d\n", targetname, fnum);
+ d_printf("posix_open file %s: for read/write fnum %d\n",
+ targetname, fnum);
}
return 0;