From f00d32feb1a92e5c5d94bfbc458c068ddea4e634 Mon Sep 17 00:00:00 2001 From: Johan Danielsson Date: Thu, 25 Jan 2001 01:33:15 +0000 Subject: [PATCH] fix bug in previous; make it easier to build test version git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9490 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/ftp/ftpd/ls.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/appl/ftp/ftpd/ls.c b/appl/ftp/ftpd/ls.c index ba279e1bf..2f7841185 100644 --- a/appl/ftp/ftpd/ls.c +++ b/appl/ftp/ftpd/ls.c @@ -30,13 +30,27 @@ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifndef TEST #include "ftpd_locl.h" RCSID("$Id$"); -#ifdef TEST +#else +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #define sec_fprintf2 fprintf #define sec_fflush fflush +void +builtin_ls(FILE *out, const char *file); int main(int argc, char **argv) { @@ -336,11 +350,16 @@ log10(int num) * have to fetch them. */ +#ifdef KRB4 +static int do_the_afs_dance = 1; +#endif + static int lstat_file (const char *file, struct stat *sb) { #ifdef KRB4 - if (k_hasafs() + if (do_the_afs_dance && + k_hasafs() && strcmp(file, ".") && strcmp(file, "..") && strcmp(file, "/")) @@ -372,7 +391,7 @@ lstat_file (const char *file, struct stat *sb) else a_params.in = last + 1; while(last > path_bkp && *--last == '/'); - if(last != path_bkp) { + if(*last != '/' || last != path_bkp) { *++last = '\0'; dir = path_bkp; } else