s3: Remove cli_errstr from cmd_posix_open
[kai/samba.git] / source3 / client / client.c
index 978f2e5dd69481051b737540a35837069f2a6b36..e2efad82d80d692c7244be21796903f280ddf402 100644 (file)
@@ -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;