diff options
author | Damien Miller <djm@mindrot.org> | 2004-01-27 21:20:11 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2004-01-27 21:20:11 +1100 |
commit | b21be844711ff285ba24cf70bfb2c7238f60c1cc (patch) | |
tree | d08dd8569da88e7328049ba552a358e5cf9c3f17 | |
parent | 4f0fe684daa4f35e1c91224e144c91b4869946fa (diff) |
- mouring@cvs.openbsd.org 2004/01/23 17:57:48
[sftp-int.c]
Fix issue pointed out with ls not handling large directories
with embeded paths correctly. OK damien@
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | sftp-int.c | 9 |
2 files changed, 13 insertions, 2 deletions
@@ -4,6 +4,10 @@ [cipher.c] enable acss for ssh ok deraadt@ markus@ + - mouring@cvs.openbsd.org 2004/01/23 17:57:48 + [sftp-int.c] + Fix issue pointed out with ls not handling large directories + with embeded paths correctly. OK damien@ - (djm) [acss.c acss.h cipher-acss.c] Portable support for ACSS if libcrypto lacks it @@ -1746,4 +1750,4 @@ - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo. Report from murple@murple.net, diagnosis from dtucker@zip.com.au -$Id: ChangeLog,v 1.3193 2004/01/27 10:19:21 djm Exp $ +$Id: ChangeLog,v 1.3194 2004/01/27 10:20:11 djm Exp $ @@ -25,7 +25,7 @@ /* XXX: recursive operations */ #include "includes.h" -RCSID("$OpenBSD: sftp-int.c,v 1.66 2004/01/13 09:25:05 djm Exp $"); +RCSID("$OpenBSD: sftp-int.c,v 1.67 2004/01/23 17:57:48 mouring Exp $"); #include "buffer.h" #include "xmalloc.h" @@ -595,17 +595,24 @@ do_ls_dir(struct sftp_conn *conn, char *path, char *strip_path, int lflag) if (!(lflag & SHORT_VIEW)) { int m = 0, width = 80; struct winsize ws; + char *tmp; /* Count entries for sort and find longest filename */ for (n = 0; d[n] != NULL; n++) m = MAX(m, strlen(d[n]->filename)); + /* Add any subpath that also needs to be counted */ + tmp = path_strip(path, strip_path); + m += strlen(tmp); + xfree(tmp); + if (ioctl(fileno(stdin), TIOCGWINSZ, &ws) != -1) width = ws.ws_col; columns = width / (m + 2); columns = MAX(columns, 1); colspace = width / columns; + colspace = MIN(colspace, width); } qsort(d, n, sizeof(*d), sdirent_comp); |