summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbeck <beck@openbsd.org>2018-04-27 15:17:53 +0000
committerbeck <beck@openbsd.org>2018-04-27 15:17:53 +0000
commit3244827f29a7fe7bcde0497cdeac3a3b22900d1f (patch)
treee2e1535df52b6a0e19e16872c225a6e2492e81ac
parentfactorize code (diff)
downloadwireguard-openbsd-3244827f29a7fe7bcde0497cdeac3a3b22900d1f.tar.xz
wireguard-openbsd-3244827f29a7fe7bcde0497cdeac3a3b22900d1f.zip
trailing whitespace, and move arg checking before pledge
in preparation for pledgepath ok deraadt@
-rw-r--r--usr.bin/nc/netcat.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/usr.bin/nc/netcat.c b/usr.bin/nc/netcat.c
index fcc38897cd9..e03199e5286 100644
--- a/usr.bin/nc/netcat.c
+++ b/usr.bin/nc/netcat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: netcat.c,v 1.190 2018/03/19 16:35:29 jsing Exp $ */
+/* $OpenBSD: netcat.c,v 1.191 2018/04/27 15:17:53 beck Exp $ */
/*
* Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
* Copyright (c) 2015 Bob Beck. All rights reserved.
@@ -349,13 +349,28 @@ main(int argc, char *argv[])
if (setrtable(rtableid) == -1)
err(1, "setrtable");
+ /* Cruft to make sure options are clean, and used properly. */
+ if (argv[0] && !argv[1] && family == AF_UNIX) {
+ host = argv[0];
+ uport = NULL;
+ } else if (argv[0] && !argv[1]) {
+ if (!lflag)
+ usage(1);
+ uport = argv[0];
+ host = NULL;
+ } else if (argv[0] && argv[1]) {
+ host = argv[0];
+ uport = argv[1];
+ } else
+ usage(1);
+
if (family == AF_UNIX) {
if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1)
err(1, "pledge");
} else if (Fflag && Pflag) {
if (pledge("stdio inet dns sendfd tty", NULL) == -1)
err(1, "pledge");
- } else if (Fflag) {
+ } else if (Fflag) {
if (pledge("stdio inet dns sendfd", NULL) == -1)
err(1, "pledge");
} else if (Pflag && usetls) {
@@ -370,21 +385,6 @@ main(int argc, char *argv[])
} else if (pledge("stdio inet dns", NULL) == -1)
err(1, "pledge");
- /* Cruft to make sure options are clean, and used properly. */
- if (argv[0] && !argv[1] && family == AF_UNIX) {
- host = argv[0];
- uport = NULL;
- } else if (argv[0] && !argv[1]) {
- if (!lflag)
- usage(1);
- uport = argv[0];
- host = NULL;
- } else if (argv[0] && argv[1]) {
- host = argv[0];
- uport = argv[1];
- } else
- usage(1);
-
if (lflag && sflag)
errx(1, "cannot use -s and -l");
if (lflag && pflag)