From fd7631c633ec0909b3d28f94f038e1e01f9e4886 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bj=C3=B6rn=20Baumbach?= Date: Fri, 22 Jul 2011 13:39:05 +0200 Subject: [PATCH] s3-utils/net_rpc_printer.c: return on read error in net_copy_file() replace cli_read_old() with cli_read() Signed-off-by: Stefan Metzmacher --- source3/utils/net_rpc_printer.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/source3/utils/net_rpc_printer.c b/source3/utils/net_rpc_printer.c index 8e8b140d37f..a8221d09315 100644 --- a/source3/utils/net_rpc_printer.c +++ b/source3/utils/net_rpc_printer.c @@ -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, -- 2.11.4.GIT