From: Harsha Sharma <harshasharmaiitr@gmail.com>
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org,
Harsha Sharma <harshasharmaiitr@gmail.com>
Subject: [PATCH] tests/monitor: Print error "this requires root" and exit
Date: Mon, 6 Nov 2017 21:04:05 +0530 [thread overview]
Message-ID: <20171106153405.6294-1-harshasharmaiitr@gmail.com> (raw)
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
next reply other threads:[~2017-11-06 15:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-06 15:34 Harsha Sharma [this message]
2017-11-06 15:42 ` [PATCH] tests/monitor: Print error "this requires root" and exit Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171106153405.6294-1-harshasharmaiitr@gmail.com \
--to=harshasharmaiitr@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).