Mercurial > gftp.yaz
changeset 851:83d39217749c
2006-11-16 Brian Masney <masneyb@gftp.org>
* lib/protocols.c - backed out last change where hidden files aren't
transferred in the subdirectories if the show_hidden_files option is
disabled.
author | masneyb |
---|---|
date | Fri, 17 Nov 2006 01:38:51 +0000 |
parents | 1c8d6b6b7950 |
children | 5e3005923374 |
files | ChangeLog lib/protocols.c |
diffstat | 2 files changed, 21 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri Nov 17 01:20:58 2006 +0000 +++ b/ChangeLog Fri Nov 17 01:38:51 2006 +0000 @@ -1,4 +1,8 @@ 2006-11-16 Brian Masney <masneyb@gftp.org> + * lib/protocols.c - backed out last change where hidden files aren't + transferred in the subdirectories if the show_hidden_files option is + disabled. + * lib/protocols.c - skip over the hidden files when doing a recursive transfer if the shown_hidden_files option is disabled. (closes #321573) @@ -3711,7 +3715,7 @@ * cvsclean - added this script - * *.[ch] - added $Id: ChangeLog,v 1.499 2006/11/17 01:20:57 masneyb Exp $ tags + * *.[ch] - added $Id: ChangeLog,v 1.500 2006/11/17 01:38:50 masneyb Exp $ tags * debian/* - updated files from Debian maintainer
--- a/lib/protocols.c Fri Nov 17 01:20:58 2006 +0000 +++ b/lib/protocols.c Fri Nov 17 01:38:51 2006 +0000 @@ -1861,37 +1861,31 @@ static GHashTable * gftp_gen_dir_hash (gftp_request * request, int *ret) { - intptr_t show_hidden_files; GHashTable * dirhash; gftp_file * fle; off_t *newsize; + dirhash = g_hash_table_new (string_hash_function, string_hash_compare); *ret = gftp_list_files (request); - if (*ret != 0) - return (NULL); - - dirhash = g_hash_table_new (string_hash_function, string_hash_compare); - gftp_lookup_request_option (request, "show_hidden_files", &show_hidden_files); - - fle = g_malloc0 (sizeof (*fle)); - while (gftp_get_next_file (request, NULL, fle) > 0) + if (*ret == 0) { - if (!show_hidden_files && *fle->file == '.' && - strcmp (fle->file, "..") != 0) + fle = g_malloc0 (sizeof (*fle)); + while (gftp_get_next_file (request, NULL, fle) > 0) { + newsize = g_malloc (sizeof (*newsize)); + *newsize = fle->size; + g_hash_table_insert (dirhash, fle->file, newsize); + fle->file = NULL; gftp_file_destroy (fle, 0); - continue; } - - newsize = g_malloc (sizeof (*newsize)); - *newsize = fle->size; - g_hash_table_insert (dirhash, fle->file, newsize); - fle->file = NULL; - gftp_file_destroy (fle, 0); + gftp_end_transfer (request); + g_free (fle); } - - gftp_end_transfer (request); - g_free (fle); + else + { + g_hash_table_destroy (dirhash); + dirhash = NULL; + } return (dirhash); } @@ -1920,16 +1914,12 @@ static GList * gftp_get_dir_listing (gftp_transfer * transfer, int getothdir, int *ret) { - intptr_t show_hidden_files; GHashTable * dirhash; GList * templist; gftp_file * fle; off_t *newsize; char *newname; - gftp_lookup_request_option (transfer->fromreq, "show_hidden_files", - &show_hidden_files); - if (getothdir && transfer->toreq != NULL) { dirhash = gftp_gen_dir_hash (transfer->toreq, ret); @@ -1950,8 +1940,7 @@ templist = NULL; while (gftp_get_next_file (transfer->fromreq, NULL, fle) > 0) { - if (strcmp (fle->file, ".") == 0 || strcmp (fle->file, "..") == 0 || - (!show_hidden_files && *fle->file == '.')) + if (strcmp (fle->file, ".") == 0 || strcmp (fle->file, "..") == 0) { gftp_file_destroy (fle, 0); continue;