From 0cfad17e4ac727314487bed9a5f6166a6a1543eb Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 16 Nov 2007 17:06:36 -0800 Subject: Fix bug #4393 smbclient does not store files with zero filesize in tar-archives from tometzky@batory.org.pl. Jeremy. (This used to be commit f3bd5e828af04f33178a66f9f332199f7d395b7b) --- source3/client/clitar.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/source3/client/clitar.c b/source3/client/clitar.c index 4ce92c674d..cb7a5deddd 100644 --- a/source3/client/clitar.c +++ b/source3/client/clitar.c @@ -608,7 +608,6 @@ static void do_atar(char *rname,char *lname,file_info *finfo1) SMB_BIG_UINT nread=0; char ftype; file_info2 finfo; - bool close_done = False; bool shallitime=True; char data[65520]; int read_size = 65520; @@ -694,7 +693,7 @@ static void do_atar(char *rname,char *lname,file_info *finfo1) DEBUG(3,("getting file %s of size %.0f bytes as a tar file %s", finfo.name, (double)finfo.size, lname)); - while (nread < finfo.size && !close_done) { + do { DEBUG(3,("nread=%.0f\n",(double)nread)); @@ -733,13 +732,13 @@ static void do_atar(char *rname,char *lname,file_info *finfo1) break; } - if (datalen == 0) { + if ( (datalen == 0) && (finfo.size != 0) ) { DEBUG(0,("Error reading file %s. Got 0 bytes\n", rname)); break; } datalen=0; - } + } while ( nread < finfo.size ); if (wrote_tar_header) { /* pad tar file with zero's if we couldn't get entire file */ -- cgit