s3-utils/net_rpc_printer.c: return on read error in net_copy_file()
authorBjörn Baumbach <bb@sernet.de>
Fri, 22 Jul 2011 11:39:05 +0000 (13:39 +0200)
committerStefan Metzmacher <metze@samba.org>
Sat, 23 Jul 2011 07:18:46 +0000 (09:18 +0200)
replace cli_read_old() with cli_read()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
source3/utils/net_rpc_printer.c

index 8e8b140d37f34e6983bc772653f92baf73f39a4c..a8221d093159646f196de1c28da857cdc8e760f2 100644 (file)
@@ -381,11 +381,20 @@ NTSTATUS net_copy_file(struct net_context *c,
        while (is_file) {
 
                /* copying file */
-               int n;
-               n = cli_read_old(cli_share_src, fnum_src, data, nread,
-                               read_size);
+               size_t n;
 
-               if (n <= 0)
+               nt_status = cli_read(cli_share_src, fnum_src, data, nread,
+                                    read_size, &n);
+               if (!NT_STATUS_IS_OK(nt_status)) {
+                       d_fprintf(stderr,
+                                 _("Error reading file [\\\\%s\%s%s]: %s\n"),
+                                 cli_state_remote_name(cli_share_src),
+                                 cli_share_src->share,
+                                 src_name, nt_errstr(nt_status));
+                       goto out;
+               }
+
+               if (n == 0)
                        break;
 
                nt_status = cli_writeall(cli_share_dst, fnum_dst, 0,