summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2015-04-03 12:52:48 +0000
committermillert <millert@openbsd.org>2015-04-03 12:52:48 +0000
commitb9475a202795978546ddb8fedc9c3e223526c0ab (patch)
tree0bbe22a04ce38b30e86afb72de8b27aedc83bf6b
parentchange types/macros to reduce the diff to linux (diff)
downloadwireguard-openbsd-b9475a202795978546ddb8fedc9c3e223526c0ab.tar.xz
wireguard-openbsd-b9475a202795978546ddb8fedc9c3e223526c0ab.zip
Only one input file is allowed with the -c/-C flags.
-rw-r--r--usr.bin/sort/sort.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/sort/sort.c b/usr.bin/sort/sort.c
index 49ea740f426..4226bb229f4 100644
--- a/usr.bin/sort/sort.c
+++ b/usr.bin/sort/sort.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sort.c,v 1.76 2015/04/03 10:37:24 tobias Exp $ */
+/* $OpenBSD: sort.c,v 1.77 2015/04/03 12:52:48 millert Exp $ */
/*-
* Copyright (C) 2009 Gabor Kovesdan <gabor@FreeBSD.org>
@@ -1042,6 +1042,10 @@ main(int argc, char *argv[])
argc -= optind;
argv += optind;
+ if (sort_opts_vals.cflag && argc > 1)
+ errx(2, "only one input file is allowed with the -%c flag",
+ sort_opts_vals.csilentflag ? 'C' : 'c');
+
if (sflag != NULL)
available_free_memory = parse_memory_buffer_value(sflag);