summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1997-01-26 00:02:25 +0000
committerderaadt <deraadt@openbsd.org>1997-01-26 00:02:25 +0000
commitb94ea9abbd7be911dc7b5d82568f9d3ee8930eb9 (patch)
tree18190d582c5931d3d1b1ae043a322ef9d43ffdc9
parentDon't do disruptive time corrections if tick size is not integral; from (diff)
downloadwireguard-openbsd-b94ea9abbd7be911dc7b5d82568f9d3ee8930eb9.tar.xz
wireguard-openbsd-b94ea9abbd7be911dc7b5d82568f9d3ee8930eb9.zip
for implied stdin, do not corrupt argv[0]
-rw-r--r--usr.bin/sort/sort.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/usr.bin/sort/sort.c b/usr.bin/sort/sort.c
index 1e5e22baaaf..1df1d5f8688 100644
--- a/usr.bin/sort/sort.c
+++ b/usr.bin/sort/sort.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sort.c,v 1.2 1997/01/22 06:53:16 millert Exp $ */
+/* $OpenBSD: sort.c,v 1.3 1997/01/26 00:02:25 deraadt Exp $ */
/*-
* Copyright (c) 1993
@@ -46,7 +46,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)sort.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: sort.c,v 1.2 1997/01/22 06:53:16 millert Exp $";
+static char rcsid[] = "$OpenBSD: sort.c,v 1.3 1997/01/26 00:02:25 deraadt Exp $";
#endif
#endif /* not lint */
@@ -217,9 +217,15 @@ main(argc, argv)
settables(fldtab[0].flags);
num_init();
fldtab->weights = gweights;
- if (optind == argc)
- argv[--optind] = devstdin;
- filelist.names = argv+optind;
+ if (optind == argc) {
+ static char *names[2];
+
+ names[0] = devstdin;
+ names[1] = NULL;
+ filelist.names = names;
+ optind--;
+ } else
+ filelist.names = argv+optind;
if (SINGL_FLD)
get = makeline;
else