From 86300fb4a4f5297dc144730bae863a9b3d4dc133 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Wed, 28 Oct 1998 16:39:53 +0000 Subject: [PATCH] Make ftpfs work even with NT. --- vfs/ChangeLog | 3 ++- vfs/ftpfs.c | 34 ++++++++++++++++++++-------------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/vfs/ChangeLog b/vfs/ChangeLog index 74107cd96..0fcd0616f 100644 --- a/vfs/ChangeLog +++ b/vfs/ChangeLog @@ -1,7 +1,8 @@ Wed Oct 28 17:06:57 1998 Pavel Machek * ftpfs.c: report which directory you are listing, fix behaviour - with servers that don't like LIST //. (Nowell) + with servers that don't like LIST //. (Nowell) Fix behaviour even + with NT. * direntry.c (vfs_s_automake): insert newly generated entry diff --git a/vfs/ftpfs.c b/vfs/ftpfs.c index 891679140..15d84297c 100644 --- a/vfs/ftpfs.c +++ b/vfs/ftpfs.c @@ -1163,7 +1163,7 @@ retrieve_dir(struct connection *bucket, char *remote_path, int resolve_symlinks) } if (sock == -1) - goto error_3; + goto fallback; #ifdef OLD_READ #define close_this_sock(x,y) fclose (x) @@ -1238,19 +1238,8 @@ retrieve_dir(struct connection *bucket, char *remote_path, int resolve_symlinks) } close_this_sock(fp, sock); disable_interrupt_key(); - if ( (get_reply (qsock (bucket), NULL, 0) != COMPLETE) || (file_list->next == file_list)) { - if (bucket->__inode_counter == 0 && !bucket->strict_rfc959_list_cmd) { - /* It's our first attempt to get a directory listing from this - server (UNIX style LIST command) */ - bucket->strict_rfc959_list_cmd = 1; - free(dcache->remote_path); - free(dcache); - linklist_destroy(file_list, direntry_destructor); - return retrieve_dir (bucket, remote_path, resolve_symlinks); - } - my_errno = EACCES; - goto error_3; - } + if ( (get_reply (qsock (bucket), NULL, 0) != COMPLETE) || (file_list->next == file_list)) + goto fallback; if (!linklist_insert(qdcache(bucket), dcache)) { my_errno = ENOMEM; goto error_3; @@ -1276,6 +1265,23 @@ error_3: linklist_destroy(file_list, direntry_destructor); print_vfs_message("ftpfs: failed"); return NULL; + +fallback: + if (bucket->__inode_counter == 0 && (!bucket->strict_rfc959_list_cmd)) { + /* It's our first attempt to get a directory listing from this + server (UNIX style LIST command) */ + bucket->strict_rfc959_list_cmd = 1; + free(dcache->remote_path); + free(dcache); + linklist_destroy(file_list, direntry_destructor); + return retrieve_dir (bucket, remote_path, resolve_symlinks); + } + my_errno = EACCES; + free(dcache->remote_path); + free(dcache); + linklist_destroy(file_list, direntry_destructor); + print_vfs_message("ftpfs: failed; nowhere to fallback to"); + return NULL; } static int