summaryrefslogtreecommitdiffstats
path: root/bin/ls
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2011-10-19 15:35:41 +0000
committerdes <des@FreeBSD.org>2011-10-19 15:35:41 +0000
commit22197e078d1481ab57a5d2567fc01b6ac5456645 (patch)
treefef3b54cc960854b76f36946983a5e6ee1932d65 /bin/ls
parent083bc8ff73e158a9f0f9830f114271948d57bada (diff)
downloadFreeBSD-src-22197e078d1481ab57a5d2567fc01b6ac5456645.zip
FreeBSD-src-22197e078d1481ab57a5d2567fc01b6ac5456645.tar.gz
If ls was invoked with -i but neither -l nor -s, blocksize was used in
display() to calculate column widths, but was not initialized in main(). This resulted in a division by zero. Noticed by: Michael Butler <imb@protected-networks.net>
Diffstat (limited to 'bin/ls')
-rw-r--r--bin/ls/ls.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/ls/ls.c b/bin/ls/ls.c
index 29471a6..b6373e2 100644
--- a/bin/ls/ls.c
+++ b/bin/ls/ls.c
@@ -414,8 +414,8 @@ main(int argc, char *argv[])
fts_options |= FTS_WHITEOUT;
#endif
- /* If -l or -s, figure out block size. */
- if (f_longform || f_size) {
+ /* If -i, -l or -s, figure out block size. */
+ if (f_inode || f_longform || f_size) {
if (f_kblocks)
blocksize = 2;
else {
OpenPOWER on IntegriCloud