diff options
author | 2015-04-03 10:07:25 +0000 | |
---|---|---|
committer | 2015-04-03 10:07:25 +0000 | |
commit | 0255d61ff959f63f65833ceb56b4d10e18087ad0 (patch) | |
tree | 3bfb3662f5c65c3d88491e12895cc67dc5b136ec | |
parent | No need to hardcode /usr/bin/ as the path to more(1); helps portability. (diff) | |
download | wireguard-openbsd-0255d61ff959f63f65833ceb56b4d10e18087ad0.tar.xz wireguard-openbsd-0255d61ff959f63f65833ceb56b4d10e18087ad0.zip |
If -S has been supplied multiple times, only take last one into account.
Without this patch, multiple -S arguments influence each other.
spotted by and ok millert@
-rw-r--r-- | usr.bin/sort/sort.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.bin/sort/sort.c b/usr.bin/sort/sort.c index e303eb9fcc3..2a959198770 100644 --- a/usr.bin/sort/sort.c +++ b/usr.bin/sort/sort.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sort.c,v 1.74 2015/04/02 21:09:51 tobias Exp $ */ +/* $OpenBSD: sort.c,v 1.75 2015/04/03 10:07:25 tobias Exp $ */ /*- * Copyright (C) 2009 Gabor Kovesdan <gabor@FreeBSD.org> @@ -856,7 +856,7 @@ set_random_seed(void) int main(int argc, char *argv[]) { - char *outfile, *real_outfile; + char *outfile, *real_outfile, *sflag; int c, result; size_t i; bool mef_flags[NUMBER_OF_MUTUALLY_EXCLUSIVE_FLAGS] = @@ -865,6 +865,7 @@ main(int argc, char *argv[]) result = 0; outfile = "-"; real_outfile = NULL; + sflag = NULL; struct sort_mods *sm = &default_sort_mods_object; @@ -930,8 +931,7 @@ main(int argc, char *argv[]) sort_opts_vals.sflag = true; break; case 'S': - available_free_memory = - parse_memory_buffer_value(optarg); + sflag = optarg; break; case 'T': tmpdir = optarg; @@ -1043,6 +1043,9 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; + if (sflag != NULL) + available_free_memory = parse_memory_buffer_value(sflag); + if (keys_num == 0) { keys_num = 1; keys = sort_reallocarray(keys, 1, sizeof(struct key_specs)); |