summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2007-04-02 18:27:34 +0200
committerJim Meyering <jim@meyering.net>2007-04-02 18:29:41 +0200
commita3b65a63a0ecbd617f59572add0109e5e5944acf (patch)
tree27f1da6c06b5da20ec63d6040e02795f2570cff9 /src
parent0b39324840ff0e6dc9b5c1666658af67b8205849 (diff)
downloadcoreutils-a3b65a63a0ecbd617f59572add0109e5e5944acf.tar.xz
* src/ls.c (print_horizontal): Fix bug reported by Mike Frysinger:
ls -x DIR would sometimes output the wrong string in place of the first entry. * NEWS: Mention the bug fix. * tests/ls/x-option: New file. * tests/ls/Makefile.am (TESTS): Add x-option.
Diffstat (limited to 'src')
-rw-r--r--src/ls.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ls.c b/src/ls.c
index b33146ce4..abb0a2692 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -4074,16 +4074,16 @@ print_horizontal (void)
size_t pos = 0;
size_t cols = calculate_columns (false);
struct column_info const *line_fmt = &column_info[cols - 1];
- size_t name_length = length_of_file_name_and_frills (cwd_file);
+ struct fileinfo const *f = sorted_file[0];
+ size_t name_length = length_of_file_name_and_frills (f);
size_t max_name_length = line_fmt->col_arr[0];
/* Print first entry. */
- print_file_name_and_frills (cwd_file);
+ print_file_name_and_frills (f);
/* Now the rest. */
for (filesno = 1; filesno < cwd_n_used; ++filesno)
{
- struct fileinfo const *f;
size_t col = filesno % cols;
if (col == 0)