Mercurial > gftp.yaz
changeset 509:b6ce74de1cd9
2004-7-24 Brian Masney <masneyb@gftp.org>
* lib/protocols.c (gftp_get_all_subdirs) - if there is an error in the
protocol function, make sure the error code is returned as is. This is
so that timeouts can be detected properly
author | masneyb |
---|---|
date | Sat, 24 Jul 2004 12:14:32 +0000 |
parents | a95c5acdacf6 |
children | e0585b062a75 |
files | ChangeLog lib/protocols.c |
diffstat | 2 files changed, 66 insertions(+), 46 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue Jul 20 02:00:59 2004 +0000 +++ b/ChangeLog Sat Jul 24 12:14:32 2004 +0000 @@ -1,3 +1,8 @@ +2004-7-24 Brian Masney <masneyb@gftp.org> + * lib/protocols.c (gftp_get_all_subdirs) - if there is an error in the + protocol function, make sure the error code is returned as is. This is + so that timeouts can be detected properly + 2004-7-19 Brian Masney <masneyb@gftp.org> * src/gtk/transfer.c src/uicommon/gftpui.h - use the new thread callback functions for retrieving the list of subdirectories @@ -2594,7 +2599,7 @@ * cvsclean - added this script - * *.[ch] - added $Id: ChangeLog,v 1.286 2004/07/20 02:00:59 masneyb Exp $ tags + * *.[ch] - added $Id: ChangeLog,v 1.287 2004/07/24 12:14:32 masneyb Exp $ tags * debian/* - updated files from Debian maintainer
--- a/lib/protocols.c Tue Jul 20 02:00:59 2004 +0000 +++ b/lib/protocols.c Sat Jul 24 12:14:32 2004 +0000 @@ -1801,6 +1801,7 @@ g_hash_table_destroy (dirhash); dirhash = NULL; } + return (dirhash); } @@ -1840,7 +1841,8 @@ else dirhash = NULL; - if (gftp_list_files (transfer->fromreq) != 0) + *ret = gftp_list_files (transfer->fromreq); + if (*ret < 0) return (NULL); fle = g_malloc (sizeof (*fle)); @@ -1881,10 +1883,9 @@ gftp_file_destroy (fle); g_free (fle); - if (dirhash) + if (dirhash != NULL) gftp_destroy_dir_hash (dirhash); - return (templist); } @@ -1929,15 +1930,18 @@ curfle->startsize = *newsize; if (curfle->size < 0 && GFTP_IS_CONNECTED (transfer->fromreq)) - curfle->size = gftp_get_file_size (transfer->fromreq, curfle->file); + { + curfle->size = gftp_get_file_size (transfer->fromreq, curfle->file); + if (curfle->size < 0) + return (curfle->size); + } if (transfer->toreq && curfle->destfile == NULL) curfle->destfile = gftp_build_path (transfer->toreq->directory, curfle->file, NULL); if (transfer->fromreq->directory != NULL && - *transfer->fromreq->directory != '\0' && - *curfle->file != '/') + *transfer->fromreq->directory != '\0' && *curfle->file != '/') { newname = gftp_build_path (transfer->fromreq->directory, curfle->file, NULL); @@ -1949,7 +1953,7 @@ break; } - if (dirhash) + if (dirhash != NULL) gftp_destroy_dir_hash (dirhash); oldfromdir = oldtodir = NULL; @@ -1962,7 +1966,9 @@ if (S_ISLNK (curfle->st_mode) && !S_ISDIR (curfle->st_mode)) { st_mode = gftp_stat_filename (transfer->fromreq, curfle->file); - if (S_ISDIR (st_mode)) + if (st_mode < 0) + return (st_mode); + else if (S_ISDIR (st_mode)) curfle->st_mode = st_mode; } @@ -1971,48 +1977,46 @@ oldfromdir = transfer->fromreq->directory; transfer->fromreq->directory = curfle->file; - if (transfer->toreq) + if (transfer->toreq != NULL) { oldtodir = transfer->toreq->directory; transfer->toreq->directory = curfle->destfile; } + forcecd = 1; - if (gftp_set_directory (transfer->fromreq, - transfer->fromreq->directory) == 0) + ret = gftp_set_directory (transfer->fromreq, + transfer->fromreq->directory); + if (ret < 0) + return (ret); + + if (curfle->startsize > 0 && transfer->toreq != NULL) { - if (curfle->startsize > 0 && transfer->toreq) - { - remotechanged = 1; - if (gftp_set_directory (transfer->toreq, - transfer->toreq->directory) != 0) - curfle->startsize = 0; - } - - ret = 0; - lastlist->next = gftp_get_dir_listing (transfer, - curfle->startsize > 0, - &ret); + remotechanged = 1; + ret = gftp_set_directory (transfer->toreq, + transfer->toreq->directory); if (ret < 0) - { - if (!GFTP_IS_CONNECTED (transfer->fromreq) || - !GFTP_IS_CONNECTED (transfer->toreq)) - return (ret); - } - - if (lastlist->next != NULL) - { - lastlist->next->prev = lastlist; - for (; lastlist->next != NULL; lastlist = lastlist->next); - } - transfer->numdirs++; - if (update_func) - update_func (transfer); + return (ret); + } + + ret = 0; + lastlist->next = gftp_get_dir_listing (transfer, + curfle->startsize > 0, + &ret); + if (ret < 0) + return (ret); + + if (lastlist->next != NULL) + { + lastlist->next->prev = lastlist; + for (; lastlist->next != NULL; lastlist = lastlist->next); } - else - curfle->transfer_action = GFTP_TRANS_ACTION_SKIP; + + transfer->numdirs++; + if (update_func != NULL) + update_func (transfer); transfer->fromreq->directory = oldfromdir; - if (transfer->toreq) + if (transfer->toreq != NULL) transfer->toreq->directory = oldtodir; } else @@ -2020,15 +2024,26 @@ } if (forcecd) - gftp_set_directory (transfer->fromreq, transfer->fromreq->directory); - if (remotechanged && transfer->toreq) - gftp_set_directory (transfer->toreq, transfer->toreq->directory); - - if (update_func) + { + ret = gftp_set_directory (transfer->fromreq, + transfer->fromreq->directory); + if (ret < 0) + return (ret); + } + + if (remotechanged && transfer->toreq != NULL) + { + ret = gftp_set_directory (transfer->toreq, transfer->toreq->directory); + if (ret < 0) + return (ret); + } + + if (update_func != NULL) { transfer->numfiles = transfer->numdirs = -1; update_func (transfer); } + return (0); }