From 7997c02b6c1a56404d5a854a6b85f41a673b944a Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 25 May 2021 13:23:17 +0200 Subject: [PATCH] ls: Fix incorrect -t sort order Dr. POSIX says -t should sort the output by mtime ascending. --- Userland/Utilities/ls.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Utilities/ls.cpp b/Userland/Utilities/ls.cpp index 739583149ae..4eff6ccb744 100644 --- a/Userland/Utilities/ls.cpp +++ b/Userland/Utilities/ls.cpp @@ -398,8 +398,8 @@ static int do_file_system_object_long(const char* path) quick_sort(files, [](auto& a, auto& b) { if (flag_sort_by_timestamp) { if (flag_reverse_sort) - return a.stat.st_mtime > b.stat.st_mtime; - return a.stat.st_mtime < b.stat.st_mtime; + return a.stat.st_mtime < b.stat.st_mtime; + return a.stat.st_mtime > b.stat.st_mtime; } // Fine, sort by name then! if (flag_reverse_sort)