# HG changeset patch # User masneyb # Date 1059936269 0 # Node ID afbbc72b73e250c3f1fdff025b6a8f77a3303ccd # Parent b42e7233533a7fb2fffad59c70b94b91bbcf240e 2003-8-3 Brian Masney * lib/local.c (local_put_file) - specify an initial file creation mode of 0644 * lib/misc.c lib/gftp.h - added gftp_parse_file_size(). This function works correctly for files greater than 2.1GB * lib/rfc959.c (rfc959_get_file) lib/protocols.c lib/rfc2068.c lib/rfc959.c - use gftp_parse_file_size() * lib/protocols.c lib/gftp.h (gftp_get_file, gftp_put_file, gftp_transfer_file) - changed type of startsize paramter from size_t to off_t diff -r b42e7233533a -r afbbc72b73e2 ChangeLog --- a/ChangeLog Fri Aug 01 01:47:54 2003 +0000 +++ b/ChangeLog Sun Aug 03 18:44:29 2003 +0000 @@ -1,3 +1,17 @@ +2003-8-3 Brian Masney + * lib/local.c (local_put_file) - specify an initial file creation mode + of 0644 + + * lib/misc.c lib/gftp.h - added gftp_parse_file_size(). This function + works correctly for files greater than 2.1GB + + * lib/rfc959.c (rfc959_get_file) lib/protocols.c lib/rfc2068.c + lib/rfc959.c - use gftp_parse_file_size() + + * lib/protocols.c lib/gftp.h (gftp_get_file, gftp_put_file, + gftp_transfer_file) - changed type of startsize paramter from size_t + to off_t + 2003-7-31 Brian Masney * lib/sshv2.c - fix blocking problem reading the error message from the remote server when there was an error establishing a connection @@ -1405,7 +1419,7 @@ * cvsclean - added this script - * *.[ch] - added $Id: ChangeLog,v 1.124 2003/08/01 01:47:52 masneyb Exp $ tags + * *.[ch] - added $Id: ChangeLog,v 1.125 2003/08/03 18:44:28 masneyb Exp $ tags * debian/* - updated files from Debian maintainer diff -r b42e7233533a -r afbbc72b73e2 lib/gftp.h --- a/lib/gftp.h Fri Aug 01 01:47:54 2003 +0000 +++ b/lib/gftp.h Sun Aug 03 18:44:29 2003 +0000 @@ -727,6 +727,8 @@ #endif +off_t gftp_parse_file_size ( char *str ); + /* protocols.c */ #define GFTP_FTP_NUM 0 #define GFTP_HTTP_NUM 1 @@ -785,22 +787,22 @@ off_t gftp_get_file ( gftp_request * request, const char *filename, int fd, - size_t startsize ); + off_t startsize ); int gftp_put_file ( gftp_request * request, const char *filename, int fd, - size_t startsize, - size_t totalsize ); + off_t startsize, + off_t totalsize ); long gftp_transfer_file ( gftp_request *fromreq, const char *fromfile, int fromfd, - size_t fromsize, + off_t fromsize, gftp_request *toreq, const char *tofile, int tofd, - size_t tosize ); + off_t tosize ); ssize_t gftp_get_next_file_chunk ( gftp_request * request, char *buf, diff -r b42e7233533a -r afbbc72b73e2 lib/local.c --- a/lib/local.c Fri Aug 01 01:47:54 2003 +0000 +++ b/lib/local.c Sun Aug 03 18:44:29 2003 +0000 @@ -167,7 +167,7 @@ flags |= O_LARGEFILE; #endif - if ((request->datafd = gftp_fd_open (request, filename, flags, 0)) == -1) + if ((request->datafd = gftp_fd_open (request, filename, flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) == -1) return (GFTP_ERETRYABLE); } else diff -r b42e7233533a -r afbbc72b73e2 lib/misc.c --- a/lib/misc.c Fri Aug 01 01:47:54 2003 +0000 +++ b/lib/misc.c Sun Aug 03 18:44:29 2003 +0000 @@ -1236,3 +1236,14 @@ #endif + +off_t +gftp_parse_file_size (char *str) +{ +#if defined (_LARGEFILE_SOURCE) + return (strtoll (str, NULL, 10)); +#else + return (strtol (str, NULL, 10)); +#endif +} + diff -r b42e7233533a -r afbbc72b73e2 lib/protocols.c --- a/lib/protocols.c Fri Aug 01 01:47:54 2003 +0000 +++ b/lib/protocols.c Sun Aug 03 18:44:29 2003 +0000 @@ -155,7 +155,7 @@ off_t gftp_get_file (gftp_request * request, const char *filename, int fd, - size_t startsize) + off_t startsize) { float maxkbs; @@ -172,13 +172,14 @@ request->cached = 0; if (request->get_file == NULL) return (GFTP_EFATAL); + return (request->get_file (request, filename, fd, startsize)); } int gftp_put_file (gftp_request * request, const char *filename, int fd, - size_t startsize, size_t totalsize) + off_t startsize, off_t totalsize) { float maxkbs; @@ -202,9 +203,9 @@ long gftp_transfer_file (gftp_request * fromreq, const char *fromfile, - int fromfd, size_t fromsize, + int fromfd, off_t fromsize, gftp_request * toreq, const char *tofile, - int tofd, size_t tosize) + int tofd, off_t tosize) { long size; int ret; @@ -1130,7 +1131,7 @@ fle->file = g_strdup (str); curpos = goto_next_token (curpos + 1); - fle->size = strtol (curpos, NULL, 10) * 512; /* Is this correct? */ + fle->size = gftp_parse_file_size (curpos) * 512; /* Is this correct? */ curpos = goto_next_token (curpos); if ((fle->datetime = parse_time (curpos, &curpos)) == 0) @@ -1176,7 +1177,7 @@ *fle->attribs = 'd'; break; case 's': - fle->size = strtol (startpos + 1, NULL, 10); + fle->size = gftp_parse_file_size (startpos + 1); break; case 'm': fle->datetime = strtol (startpos + 1, NULL, 10); @@ -1291,7 +1292,7 @@ /* This is a regular file */ if ((endpos = strchr (startpos, ' ')) == NULL) return (GFTP_EFATAL); - fle->size = strtol (startpos, NULL, 10); + fle->size = gftp_parse_file_size (startpos); } /* Skip the blanks till we get to the next entry */ @@ -1342,7 +1343,7 @@ else { fle->attribs = g_strdup ("-rw-rw-rw-"); - fle->size = strtol (startpos, NULL, 10); + fle->size = gftp_parse_file_size (startpos); } startpos = goto_next_token (startpos); @@ -1370,7 +1371,7 @@ fle->group = g_strdup (_("unknown")); - fle->size = strtol (startpos, NULL, 10); + fle->size = gftp_parse_file_size (startpos); startpos = goto_next_token (startpos); if ((fle->datetime = parse_time (startpos, &startpos)) == 0) diff -r b42e7233533a -r afbbc72b73e2 lib/rfc2068.c --- a/lib/rfc2068.c Fri Aug 01 01:47:54 2003 +0000 +++ b/lib/rfc2068.c Sun Aug 03 18:44:29 2003 +0000 @@ -134,7 +134,7 @@ tempstr); if (strncmp (tempstr, "Content-Length:", 15) == 0) - params->content_length = strtol (tempstr + 16, NULL, 10); + params->content_length = gftp_parse_file_size (tempstr + 16); else if (strcmp (tempstr, "Transfer-Encoding: chunked") == 0) chunked = 1; } @@ -592,11 +592,11 @@ stpos--; if ((*stpos == '.') && isdigit (*(stpos + 1))) { /* found decimal point */ - fle->size = units * strtol (stpos + 1, NULL, 10) / 10;; + fle->size = units * gftp_parse_file_size (stpos + 1) / 10;; } } - fle->size += units * strtol (stpos, NULL, 10); + fle->size += units * gftp_parse_file_size (stpos); return (1); } diff -r b42e7233533a -r afbbc72b73e2 lib/rfc959.c --- a/lib/rfc959.c Fri Aug 01 01:47:54 2003 +0000 +++ b/lib/rfc959.c Sun Aug 03 18:44:29 2003 +0000 @@ -1067,7 +1067,7 @@ else tempstr++; - return (strtol (tempstr, NULL, 10) + startsize); + return (gftp_parse_file_size (tempstr) + startsize); }