summaryrefslogtreecommitdiff
path: root/source3/client/clitar.c
diff options
context:
space:
mode:
authorHerb Lewis <herb@samba.org>2002-12-19 20:23:45 +0000
committerHerb Lewis <herb@samba.org>2002-12-19 20:23:45 +0000
commitc52a34693d8bb007b246a365aa1ca7502156d9d2 (patch)
tree52804c4d45446fac92a7defbce8f206920cda4ce /source3/client/clitar.c
parentc26dd35c76e671bd566c709510aa97deb1bf1192 (diff)
downloadsamba-c52a34693d8bb007b246a365aa1ca7502156d9d2.tar.gz
samba-c52a34693d8bb007b246a365aa1ca7502156d9d2.tar.bz2
samba-c52a34693d8bb007b246a365aa1ca7502156d9d2.zip
merge from 2.2 fix for smbclient large files
(This used to be commit 723c4caf64c56b78052c52fec78c7143ec19e944)
Diffstat (limited to 'source3/client/clitar.c')
-rw-r--r--source3/client/clitar.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index bf26beb652..bf4b6e592a 100644
--- a/source3/client/clitar.c
+++ b/source3/client/clitar.c
@@ -121,11 +121,11 @@ extern int get_total_size;
static int blocksize=20;
static int tarhandle;
-static void writetarheader(int f, char *aname, int size, time_t mtime,
+static void writetarheader(int f, char *aname, SMB_BIG_UINT size, time_t mtime,
char *amode, unsigned char ftype);
static void do_atar(char *rname,char *lname,file_info *finfo1);
static void do_tar(file_info *finfo);
-static void oct_it(long value, int ndgs, char *p);
+static void oct_it(SMB_BIG_UINT value, int ndgs, char *p);
static void fixtarname(char *tptr, char *fp, int l);
static int dotarbuf(int f, char *b, int n);
static void dozerobuf(int f, int n);
@@ -164,14 +164,14 @@ static char *string_create_s(int size)
/****************************************************************************
Write a tar header to buffer
****************************************************************************/
-static void writetarheader(int f, char *aname, int size, time_t mtime,
+static void writetarheader(int f, char *aname, SMB_BIG_UINT size, time_t mtime,
char *amode, unsigned char ftype)
{
union hblock hb;
int i, chk, l;
char *jp;
- DEBUG(5, ("WriteTarHdr, Type = %c, Size= %i, Name = %s\n", ftype, size, aname));
+ DEBUG(5, ("WriteTarHdr, Type = %c, Size= %.0f, Name = %s\n", ftype, (double)size, aname));
memset(hb.dummy, 0, sizeof(hb.dummy));
@@ -203,17 +203,17 @@ static void writetarheader(int f, char *aname, int size, time_t mtime,
hb.dbuf.name[NAMSIZ-1]='\0';
safe_strcpy(hb.dbuf.mode, amode, strlen(amode));
- oct_it(0L, 8, hb.dbuf.uid);
- oct_it(0L, 8, hb.dbuf.gid);
- oct_it((long) size, 13, hb.dbuf.size);
- oct_it((long) mtime, 13, hb.dbuf.mtime);
+ oct_it((SMB_BIG_UINT)0, 8, hb.dbuf.uid);
+ oct_it((SMB_BIG_UINT)0, 8, hb.dbuf.gid);
+ oct_it((SMB_BIG_UINT) size, 13, hb.dbuf.size);
+ oct_it((SMB_BIG_UINT) mtime, 13, hb.dbuf.mtime);
memcpy(hb.dbuf.chksum, " ", sizeof(hb.dbuf.chksum));
memset(hb.dbuf.linkname, 0, NAMSIZ);
hb.dbuf.linkflag=ftype;
for (chk=0, i=sizeof(hb.dummy), jp=hb.dummy; --i>=0;) chk+=(0xFF & *jp++);
- oct_it((long) chk, 8, hb.dbuf.chksum);
+ oct_it((SMB_BIG_UINT) chk, 8, hb.dbuf.chksum);
hb.dbuf.chksum[6] = '\0';
(void) dotarbuf(f, hb.dummy, sizeof(hb.dummy));
@@ -427,7 +427,7 @@ static void fixtarname(char *tptr, char *fp, int l)
/****************************************************************************
Convert from decimal to octal string
****************************************************************************/
-static void oct_it (long value, int ndgs, char *p)
+static void oct_it (SMB_BIG_UINT value, int ndgs, char *p)
{
/* Converts long to octal string, pads with leading zeros */
@@ -598,7 +598,7 @@ append one remote file to the tar file
static void do_atar(char *rname,char *lname,file_info *finfo1)
{
int fnum;
- uint32 nread=0;
+ SMB_BIG_UINT nread=0;
char ftype;
file_info2 finfo;
BOOL close_done = False;
@@ -688,9 +688,9 @@ static void do_atar(char *rname,char *lname,file_info *finfo1)
}
else
{
- DEBUG(3,("getting file %s of size %d bytes as a tar file %s",
+ DEBUG(3,("getting file %s of size %.0f bytes as a tar file %s",
finfo.name,
- (int)finfo.size,
+ (double)finfo.size,
lname));
/* write a tar header, don't bother with mode - just set to 100644 */
@@ -698,7 +698,7 @@ static void do_atar(char *rname,char *lname,file_info *finfo1)
while (nread < finfo.size && !close_done) {
- DEBUG(3,("nread=%d\n",nread));
+ DEBUG(3,("nread=%.0f\n",(double)nread));
datalen = cli_read(cli, fnum, data, nread, read_size);
@@ -715,7 +715,7 @@ static void do_atar(char *rname,char *lname,file_info *finfo1)
if (nread > finfo.size) {
datalen -= nread - finfo.size;
- DEBUG(0,("File size change - truncating %s to %d bytes\n", finfo.name, (int)finfo.size));
+ DEBUG(0,("File size change - truncating %s to %.0f bytes\n", finfo.name, (double)finfo.size));
}
/* add received bits of file to buffer - dotarbuf will
@@ -735,7 +735,7 @@ static void do_atar(char *rname,char *lname,file_info *finfo1)
/* pad tar file with zero's if we couldn't get entire file */
if (nread < finfo.size) {
- DEBUG(0, ("Didn't get entire file. size=%d, nread=%d\n", (int)finfo.size, (int)nread));
+ DEBUG(0, ("Didn't get entire file. size=%.0f, nread=%d\n", (double)finfo.size, (int)nread));
if (padit(data, sizeof(data), finfo.size - nread))
DEBUG(0,("Error writing tar file - %s\n", strerror(errno)));
}
@@ -768,8 +768,8 @@ static void do_atar(char *rname,char *lname,file_info *finfo1)
if (tar_noisy)
{
- DEBUG(0, ("%10d (%7.1f kb/s) %s\n",
- (int)finfo.size, finfo.size / MAX(0.001, (1.024*this_time)),
+ DEBUG(0, ("%12.0f (%7.1f kb/s) %s\n",
+ (double)finfo.size, finfo.size / MAX(0.001, (1.024*this_time)),
finfo.name));
}