aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/sort.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/coreutils/sort.c b/coreutils/sort.c
index a1625fc9c..1cb4c3e3f 100644
--- a/coreutils/sort.c
+++ b/coreutils/sort.c
@@ -225,7 +225,7 @@ static int compare_keys(const void *xarg, const void *yarg)
225 y = *(char **)yarg; 225 y = *(char **)yarg;
226#endif 226#endif
227 /* Perform actual comparison */ 227 /* Perform actual comparison */
228 switch (flags & 7) { 228 switch (flags & (FLAG_n | FLAG_M | FLAG_g)) {
229 default: 229 default:
230 bb_error_msg_and_die("unknown sort type"); 230 bb_error_msg_and_die("unknown sort type");
231 break; 231 break;
@@ -302,10 +302,14 @@ static int compare_keys(const void *xarg, const void *yarg)
302 } /* for */ 302 } /* for */
303 303
304 /* Perform fallback sort if necessary */ 304 /* Perform fallback sort if necessary */
305 if (!retval && !(option_mask32 & FLAG_s)) 305 if (!retval && !(option_mask32 & FLAG_s)) {
306 retval = strcmp(*(char **)xarg, *(char **)yarg); 306 retval = strcmp(*(char **)xarg, *(char **)yarg);
307 flags = option_mask32;
308 }
309
310 if (flags & FLAG_r)
311 return -retval;
307 312
308 if (flags & FLAG_r) return -retval;
309 return retval; 313 return retval;
310} 314}
311 315