diff options
Diffstat (limited to 'coreutils/sort.c')
-rw-r--r-- | coreutils/sort.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/coreutils/sort.c b/coreutils/sort.c index 9aac656fe..01b7c44e5 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c | |||
@@ -357,9 +357,9 @@ static int compare_keys(const void *xarg, const void *yarg) | |||
357 | int dx; | 357 | int dx; |
358 | char *xx, *yy; | 358 | char *xx, *yy; |
359 | 359 | ||
360 | xx = strptime(x, "%b", &thyme); | 360 | xx = strptime(skip_whitespace(x), "%b", &thyme); |
361 | dx = thyme.tm_mon; | 361 | dx = thyme.tm_mon; |
362 | yy = strptime(y, "%b", &thyme); | 362 | yy = strptime(skip_whitespace(y), "%b", &thyme); |
363 | if (!xx) | 363 | if (!xx) |
364 | retval = (!yy) ? 0 : -1; | 364 | retval = (!yy) ? 0 : -1; |
365 | else if (!yy) | 365 | else if (!yy) |
@@ -652,11 +652,12 @@ int sort_main(int argc UNUSED_PARAM, char **argv) | |||
652 | /* Handle -u */ | 652 | /* Handle -u */ |
653 | if (option_mask32 & FLAG_u) { | 653 | if (option_mask32 & FLAG_u) { |
654 | int j = 0; | 654 | int j = 0; |
655 | /* coreutils 6.3 drop lines for which only key is the same | 655 | /* coreutils 6.3 drop lines for which only key is the same: |
656 | * -- disabling last-resort compare, or else compare_keys() | 656 | * - disabling last-resort compare, or else compare_keys() |
657 | * will be the same only for completely identical lines. | 657 | * will be the same only for completely identical lines |
658 | * - disabling -s (same reasons) | ||
658 | */ | 659 | */ |
659 | option_mask32 |= FLAG_no_tie_break; | 660 | option_mask32 = (option_mask32 | FLAG_no_tie_break) & (~FLAG_s); |
660 | for (i = 1; i < linecount; i++) { | 661 | for (i = 1; i < linecount; i++) { |
661 | if (compare_keys(&lines[j], &lines[i]) == 0) | 662 | if (compare_keys(&lines[j], &lines[i]) == 0) |
662 | free(lines[i]); | 663 | free(lines[i]); |