summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--sftp-int.c9
2 files changed, 13 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 61b714348..8cf7e5eba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,10 @@
4 [cipher.c] 4 [cipher.c]
5 enable acss for ssh 5 enable acss for ssh
6 ok deraadt@ markus@ 6 ok deraadt@ markus@
7 - mouring@cvs.openbsd.org 2004/01/23 17:57:48
8 [sftp-int.c]
9 Fix issue pointed out with ls not handling large directories
10 with embeded paths correctly. OK damien@
7 - (djm) [acss.c acss.h cipher-acss.c] Portable support for ACSS 11 - (djm) [acss.c acss.h cipher-acss.c] Portable support for ACSS
8 if libcrypto lacks it 12 if libcrypto lacks it
9 13
@@ -1746,4 +1750,4 @@
1746 - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo. 1750 - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo.
1747 Report from murple@murple.net, diagnosis from dtucker@zip.com.au 1751 Report from murple@murple.net, diagnosis from dtucker@zip.com.au
1748 1752
1749$Id: ChangeLog,v 1.3193 2004/01/27 10:19:21 djm Exp $ 1753$Id: ChangeLog,v 1.3194 2004/01/27 10:20:11 djm Exp $
diff --git a/sftp-int.c b/sftp-int.c
index a9423fe69..3ee57515d 100644
--- a/sftp-int.c
+++ b/sftp-int.c
@@ -25,7 +25,7 @@
25/* XXX: recursive operations */ 25/* XXX: recursive operations */
26 26
27#include "includes.h" 27#include "includes.h"
28RCSID("$OpenBSD: sftp-int.c,v 1.66 2004/01/13 09:25:05 djm Exp $"); 28RCSID("$OpenBSD: sftp-int.c,v 1.67 2004/01/23 17:57:48 mouring Exp $");
29 29
30#include "buffer.h" 30#include "buffer.h"
31#include "xmalloc.h" 31#include "xmalloc.h"
@@ -595,17 +595,24 @@ do_ls_dir(struct sftp_conn *conn, char *path, char *strip_path, int lflag)
595 if (!(lflag & SHORT_VIEW)) { 595 if (!(lflag & SHORT_VIEW)) {
596 int m = 0, width = 80; 596 int m = 0, width = 80;
597 struct winsize ws; 597 struct winsize ws;
598 char *tmp;
598 599
599 /* Count entries for sort and find longest filename */ 600 /* Count entries for sort and find longest filename */
600 for (n = 0; d[n] != NULL; n++) 601 for (n = 0; d[n] != NULL; n++)
601 m = MAX(m, strlen(d[n]->filename)); 602 m = MAX(m, strlen(d[n]->filename));
602 603
604 /* Add any subpath that also needs to be counted */
605 tmp = path_strip(path, strip_path);
606 m += strlen(tmp);
607 xfree(tmp);
608
603 if (ioctl(fileno(stdin), TIOCGWINSZ, &ws) != -1) 609 if (ioctl(fileno(stdin), TIOCGWINSZ, &ws) != -1)
604 width = ws.ws_col; 610 width = ws.ws_col;
605 611
606 columns = width / (m + 2); 612 columns = width / (m + 2);
607 columns = MAX(columns, 1); 613 columns = MAX(columns, 1);
608 colspace = width / columns; 614 colspace = width / columns;
615 colspace = MIN(colspace, width);
609 } 616 }
610 617
611 qsort(d, n, sizeof(*d), sdirent_comp); 618 qsort(d, n, sizeof(*d), sdirent_comp);