Fix bug 1578774. Patch by rvp74 at users.sourceforge.net.

This commit is contained in:
braga
2006-10-23 13:14:11 +00:00
parent 41ec6c20c1
commit ee59182a3b
2 changed files with 9 additions and 4 deletions

View File

@@ -27,7 +27,7 @@ static int parse_dir_unix(const char *line,
long nlink = 1; long nlink = 1;
char user[33]; char user[33];
char group[33]; char group[33];
long size; unsigned long long size;
char month[4]; char month[4];
char day[3]; char day[3];
char year[6]; char year[6];
@@ -46,7 +46,7 @@ static int parse_dir_unix(const char *line,
"%lu" SPACES "%lu" SPACES
"%32s" SPACES "%32s" SPACES
"%32s" SPACES "%32s" SPACES
"%lu" SPACES "%llu" SPACES
"%3s" SPACES "%3s" SPACES
"%2s" SPACES "%2s" SPACES
"%5s" "%*c" "%5s" "%*c"
@@ -57,7 +57,7 @@ static int parse_dir_unix(const char *line,
"%11s" "%11s"
"%32s" SPACES "%32s" SPACES
"%32s" SPACES "%32s" SPACES
"%lu" SPACES "%llu" SPACES
"%3s" SPACES "%3s" SPACES
"%2s" SPACES "%2s" SPACES
"%5s" "%*c" "%5s" "%*c"
@@ -156,7 +156,7 @@ static int parse_dir_win(const char *line,
if (!strcmp(size, "<DIR>")) { if (!strcmp(size, "<DIR>")) {
sbuf->st_mode |= S_IFDIR; sbuf->st_mode |= S_IFDIR;
} else { } else {
int nsize = strtol(size, NULL, 0); unsigned long long nsize = strtoull(size, NULL, 0);
sbuf->st_mode |= S_IFREG; sbuf->st_mode |= S_IFREG;
sbuf->st_size = nsize; sbuf->st_size = nsize;
if (ftpfs.blksize) { if (ftpfs.blksize) {

View File

@@ -138,5 +138,10 @@ int main(int argc, char **argv) {
assert(err == 0); assert(err == 0);
check(sbuf, 0, 0, S_IFDIR|S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IXOTH, 144, 0, 0, 0, 10240, 4096, 24, "00:00:00 31/12/2005"); check(sbuf, 0, 0, S_IFDIR|S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IXOTH, 144, 0, 0, 0, 10240, 4096, 24, "00:00:00 31/12/2005");
list = "-rw------- 1 6700 2000 6561177600 Oct 15 2005 home.backup.tar\r\n";
err = parse_dir(list, "/", "home.backup.tar", &sbuf, NULL, 0, NULL, NULL);
assert(err == 0);
check(sbuf, 0, 0, S_IFREG|S_IRUSR|S_IWUSR, 1, 0, 0, 0, 6561177600LL, 4096, 4426192, "00:00:00 15/10/2005");
return 0; return 0;
} }