summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2015-04-03 12:52:49 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2015-04-03 12:52:49 +0000
commit2e1df06368bf1ab89bdcbd423bf3af0402c7b156 (patch)
treeca5cf8ca84a982a8b8aa11636f66d0262a10d098
parent8c2b5e39b87c438a51d5d00f88a8b99fa887fe2f (diff)
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);