From 94400e62a03bc02c69070297b92ea9d2e22132c3 Mon Sep 17 00:00:00 2001 From: John Marino Date: Sun, 12 Feb 2017 20:25:18 -0600 Subject: [PATCH] sort(1): Fix some obvious issues Taken-from: FreeBSD --- usr.bin/sort/bwstring.c | 2 +- usr.bin/sort/coll.c | 2 +- usr.bin/sort/sort.1 | 2 +- usr.bin/sort/sort.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/usr.bin/sort/bwstring.c b/usr.bin/sort/bwstring.c index 38e72e6b49..82b2168acd 100644 --- a/usr.bin/sort/bwstring.c +++ b/usr.bin/sort/bwstring.c @@ -297,7 +297,7 @@ bwscsbdup(const unsigned char *str, size_t len) /* NOTREACHED */ err(2, "mbrtowc error"); cptr += charlen; - }; + } } ret->len = chars; diff --git a/usr.bin/sort/coll.c b/usr.bin/sort/coll.c index 03af045203..8a74caf094 100644 --- a/usr.bin/sort/coll.c +++ b/usr.bin/sort/coll.c @@ -1090,7 +1090,7 @@ cmp_nans(double d1, double d2) if (d1 < d2) return (-1); - if (d2 > d2) + if (d1 > d2) return (+1); return (0); } diff --git a/usr.bin/sort/sort.1 b/usr.bin/sort/sort.1 index 27afac22b9..7c95ed7ad2 100644 --- a/usr.bin/sort/sort.1 +++ b/usr.bin/sort/sort.1 @@ -133,7 +133,7 @@ also checks that there are no lines with duplicate keys. .It Fl s Stable sort. This option maintains the original record order of records that have -and equal key. +an equal key. This is a non-standard feature, but it is widely accepted and used. .It Fl Fl version Print the version and silently exits. diff --git a/usr.bin/sort/sort.c b/usr.bin/sort/sort.c index d534086265..a907757669 100644 --- a/usr.bin/sort/sort.c +++ b/usr.bin/sort/sort.c @@ -280,7 +280,7 @@ set_hw_params(void) pages = sysconf(_SC_PHYS_PAGES); if (pages < 1) { perror("sysconf pages"); - psize = 1; + pages = 1; } psize = sysconf(_SC_PAGESIZE); if (psize < 1) { -- 2.11.4.GIT