netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tests/monitor: Print error "this requires root" and exit
@ 2017-11-06 15:34 Harsha Sharma
  2017-11-06 15:42 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Harsha Sharma @ 2017-11-06 15:34 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel, Harsha Sharma

If executed without root privileges, print error "this requires root!"
and exit.

Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
---
 tests/monitor/run-tests.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/monitor/run-tests.sh b/tests/monitor/run-tests.sh
index 23d4e21..1adabda 100755
--- a/tests/monitor/run-tests.sh
+++ b/tests/monitor/run-tests.sh
@@ -8,6 +8,11 @@ mydiff() {
 	diff -w -I '^# ' "$@"
 }
 
+if [ "$(id -u)" != "0" ] ; then
+	echo "this requires root!"
+	exit 1
+fi
+
 testdir=$(mktemp -d)
 if [ ! -d $testdir ]; then
 	echo "Failed to create test directory" >&2
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-06 15:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-06 15:34 [PATCH] tests/monitor: Print error "this requires root" and exit Harsha Sharma
2017-11-06 15:42 ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).