summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/sort.c8
1 files changed, 6 insertions, 2 deletions
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;
}