From 5c13ab41bb9472b792797a339f93a3a3ca62fd7a Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Sun, 19 Jan 2014 09:10:14 +0100 Subject: sort: check global flags on fallback sort Sort now performs global reverse on fallback sort if -r is set. Before only key local flags were checked. function old new delta compare_keys 712 738 +26 Signed-off-by: Bartosz Golaszewski Signed-off-by: Denys Vlasenko --- coreutils/sort.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'coreutils') diff --git a/coreutils/sort.c b/coreutils/sort.c index 0b3b650..1cb4c3e 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c @@ -302,10 +302,14 @@ static int compare_keys(const void *xarg, const void *yarg) } /* for */ /* Perform fallback sort if necessary */ - if (!retval && !(option_mask32 & FLAG_s)) + if (!retval && !(option_mask32 & FLAG_s)) { retval = strcmp(*(char **)xarg, *(char **)yarg); + flags = option_mask32; + } + + if (flags & FLAG_r) + return -retval; - if (flags & FLAG_r) return -retval; return retval; } -- cgit v1.1