summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Lievisse Adriaanse <jasper@cvs.openbsd.org>2016-09-09 19:48:17 +0000
committerJasper Lievisse Adriaanse <jasper@cvs.openbsd.org>2016-09-09 19:48:17 +0000
commit800675f25353bfb0f5da5c98aa2738da08bf8cc6 (patch)
tree7b5c2aaf1be6f166cf2e0a4084472a39ac7b8998
parentfbe8ac64e7e8917ecf087aebedcb7b5056398388 (diff)
print a clear error message when not ran as root instead of just falling
through and try whatever it can do with the invoking user's perms feedback/ok aja@ rpe@
-rw-r--r--etc/netstart8
1 files changed, 7 insertions, 1 deletions
diff --git a/etc/netstart b/etc/netstart
index 62b9ed13455..60b0dea74fa 100644
--- a/etc/netstart
+++ b/etc/netstart
@@ -1,6 +1,6 @@
#!/bin/sh -
#
-# $OpenBSD: netstart,v 1.169 2016/07/19 08:03:01 mpi Exp $
+# $OpenBSD: netstart,v 1.170 2016/09/09 19:48:16 jasper Exp $
# Turn off Strict Bourne shell mode.
set +o sh
@@ -167,6 +167,12 @@ ifv6autoconf() {
done
}
+# Make sure the invoking user has the right privileges.
+if (($(id -u) != 0)); then
+ echo "${0##*/}: need root privileges"
+ exit 1
+fi
+
# Get network related vars from rc.conf using the parsing routine from rc.subr.
FUNCS_ONLY=1 . /etc/rc.d/rc.subr
_rc_parse_conf